Forum  General Visual ...  How do I...?  Skinnable Control
Previous Previous
 
Next Next
New Post 6/12/2012 8:32 AM
  GaneshAnanthu
39 posts
No Ranking


Skinnable Control 
Modified By GaneshAnanthu  on 6/12/2012 11:37:27 AM)

 Hi, I was testing a simple custom button Skinnable Control with the button skin property's set to backcolor as "HotTrack" and ForeColor as "DarkRed", I attached this skin to one of the button in the usercontrol as CustomStyle. When I run the application I don't see the color change rather button shows in default color settings. Is the default theme is overriding the customstyle? How can I over come this issue?

Thanks

Ganesh

 
New Post 6/14/2012 3:03 PM
  palli
14324 posts
1st Level Poster




Re: Skinnable Control 

 Hi Ganesh,

Normally you would drop an instance of your Skinable Button to the form, instead of dropping a standard Button and change CustomStyle, but it should work though.... some of it that is. ForeColor should work fine, but BackColor isn't actually used for the background of the button, as there is a repeated image that makes up the background. For normal Button it would be ButtonButtonNormal.gif.

As you don't see the ForeColor change, make sure you register your skinable control in web.config and clear your cache and it should work fine.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 6/20/2012 11:46 AM
  GaneshAnanthu
39 posts
No Ranking


Re: Skinnable Control 

 Thanks Palli, It did work after I register both the custom control and its skin! Iniially I just had the skin registered and the Default theme was checked and it never used to refresh it with the custom skin. Basically we would like to have a custom skins only and would like to apply those to a set of controls on need basis and this helps a lot. Thanks again.

 
New Post 6/21/2012 2:19 PM
  GaneshAnanthu
39 posts
No Ranking


Re: Skinnable Control 

 Palli, I have other related question to skinnable controls. Can I able to have a multiple flavor of same skinnable control? How can I accomplish that? 

Example: Custom Label with Custom Label SKin 1, Custom Lable Skin 2 and so on....and depending upon the need I would like to change the skin in the code dynamically.

Thanks!

 
New Post 6/25/2012 5:17 AM
  palli
14324 posts
1st Level Poster




Re: Skinnable Control 

 Hi Ganesh,

You don't have to register the skin in web.config, only the custom (skinable) control. 

The skin properties and styles for a (custom / skinable) control are static within the skin, so you can't switch them at runtime. Many of the attributes are setable on the controls themselves at runtime (like forecolor, backcolor etc.), but those that need skinability there are basically two options that I can think of right now.

You can create a Skinable control for each flavor you want to implement, which would mean you have x number of skinable control which you must all register in web.config. At runtime, you could then simply set the control.CustomStyle to any of the available custom styles you have prepared, and as they would all be inheriting from the same base control, they would work the same as the base control but render in different flavor.

Second option is very similar, except you would build only one skinable control, but modify the skin (the xslt, css ...) to handle more than one flavor and handle it correctly, meaning that when flavor-a is detected you would render the control with the correct css for that flavor etc. The same approach would work for switching flavors runtime, meaning you simply assign a different value to Control.CustomStyle. For this method, you would have to make sure the XSLT would match all the flavors based on the different CustomStyle values you want to offer. 

The difference between these two flavoring methods is not that much, as the single-control solution would need to have all the matching in one xslt what would be matched by individual controls in the multi-control solution.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  Skinnable Control
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS