Last post May 03, 2009 10:19 AM by artit
Apr 02, 2008 06:44 PM|kunta|LINK
I am using Visual Studio 2008 and I have a very simple custom web server control class named TestControl. The class inherits from CompositeControl, with two child controls: Label myLabel and TextBox myTextBox. In my TestWebForm
the Theme attribute is set appropriately to a Theme where I have defined skins with font attributes for "regular" Label and TextBox controls and for the TestControl class.
At run time everything is fine: the skin (font attributes) is applied to child controls,
but I cannot force the ASP.NET VS designer to apply skin attributes at design time!
Actually, I have found two ways to apply the skin to child controls:
I have tried also:
Nothing helps! The only way I have managed to get child controls font attributes displayed somehow at design time, is to set Font.Name and Font.Size in the TestControl constructor or to manually set these properties
in the designer's property grid. But it is not what I really need. Another interesting thing is that when I inherit a control from eg. TextBox control, not CompositeControl, the designer applies the skin (if skin is defined for custom TextBox control, not
for "regular" TextBox). Is it possible to get the design time behavior as I expect? Please, help! Here is the source code (there is no code in TestWebForm codebehind class):
myTextBox.Width = 100;
Apr 04, 2008 06:18 PM|jkirkerx|LINK
myTextBox."Turn on theming" , whatever intellisense tells you, then select the skin or theme
I don't remember the exact syntax for it in CS
this.Font.Name, Font.Name needs a value
myTextBox.Font.Name = "Tahoma" or whatever is presented by the intellisense
Apr 04, 2008 08:20 PM|kunta|LINK
Thank you jkirkerx, nice try! I have found what you meant, I suppose:
myTextBox.EnableTheming = true;
Doesn't help! [:(] Anyone could try my example, please?
Apr 05, 2008 01:17 PM|jkirkerx|LINK
It's not a complete fix, just the next step you needed to make it work. But you on the right track.
Now you need to grab the property element for styles in your control property panel, and apply the actual style to it.
You can manually apply the style = "MyStyle" to test first, and then apply the property value later after you confirm that it works.
Apr 06, 2008 04:55 AM|kunta|LINK
Thank you again, but I am a little confused whit this answer. How do you think "to grab the property element for styles in your control property panel, and apply the actual style to it"? There are properties: CssClass, which is not the skin, SkinID
which is not working and a bunch of style properties like BorderColor, BorderStyle, Font etc. What do you mean with "the property element for styles"?
Nevertheless, I think this is not the point. I repeat: the skin is applied to the main composite control (its span tag is properly rendered), but the skin
is not applied to the CHILD CONTROLS. I don't want to programmatically apply each skin attribute for each child control (this is not theming and skinning) and I even don't know how would it be possible (there is no way to grab the skin properties from
the skin files anyhow).
Apr 06, 2008 02:12 PM|jkirkerx|LINK
Your right , SkinID, my bad.
If you go into designer view, and click on your control, you can access the properties of that control. Just like a regular control such as textbox.
In the list of properties, you'll see SkinID. Type in the name or ID of your SkinID and set the value.
In your Control code, you can grab the SkinID value. In vb, It's [SkinID] with the square brackets. I don't know what it is in CSharp off the top of my head.
myTextBox.SkinID = [SkinID] 'for VB
myTextBox.CssStyle = [CssStyle]
This is how you can grab predefined values from the property box, and use them in your control.
This is just help on the Control Side issue of your post. I'm not offering help on the skin side issue of your post. I don't do skins.
I've messed around with skins, but ended up using themes. The themes were merely CSS Style collections that could be changed on the fly through code. The skins were system wide in which all Label, TextBox, Button, etc would acquire that look and feel.
If I made cooler looking sites such as gaming sites, or music sites, I would use skins. I stopped using themes, because of the large amount of time it takes to create good looking themes.
May 03, 2009 10:19 AM|artit|LINK
I has the same problem as you and after I google for a while I found a solution. In design time "theme" doesn't work but "styleSheetTheme" works. You can edit following line in web.config to apply theme in design time.
<pages pageBaseType="PageBase" styleSheetTheme="YourThemeName" />
You can read more from http://blogs.msdn.com/markjo/archive/2006/09/22/766048.aspx
apply theme skin design time