Programmatically Creating Themes and Skins

C

Cramer

According to the MSDN docs, we cannot programatically create our own themes
or skins:
"Page and control developers do not use the ControlSkinDelegate,
ControlSkin, or PageTheme classes directly. These classes are used by the
ASP.NET parser and runtime ... " (from
http://msdn.microsoft.com/en-us/library/system.web.ui.pagetheme.aspx).

My question:
Is there really no way that we can programmatically create our own themes
and have ASP.NET apply them to our pages and controls? I would like to
programmatically create my own themse, and not have to go with the expected
App_Themes directory for all of my themes. Is there some alternative I can
use?

Thanks
 
S

Stan

According to the MSDN docs, we cannot programatically create our own themes
or skins:
"Page and control developers do not use the ControlSkinDelegate,
ControlSkin, or PageTheme classes directly. These classes are used by the
ASP.NET parser and runtime ... " (fromhttp://msdn.microsoft.com/en-us/library/system.web.ui.pagetheme.aspx).

My question:
Is there really no way that we can programmatically create our own themes
and have ASP.NET apply them to our pages and controls? I would like to
programmatically create my own themse, and not have to go with the expected
App_Themes directory for all of my themes. Is there some alternative I can
use?

Thanks

You can change the allocation of themes to controls programatically
just as you can dynamically associate CSS classes and styles. However
the dynamic creation of new style sheets and skin files is outside
their designed purpose. The location of the theme files is fixed
because that is where ASP.NET has been hard coded to expect them (or
maybe set in machine.config).

I'm not suggesting that this can't be circumvented in some way but I
wonder whether it's worth the effort. If there is a need to vary style
attributes at run time based on some computed criteria, then it
doesn't have to come from style sheets or skin files. It could be
derived from re-useable code of your own creation (e.g. in a class
file) consisting of functions returning style objects or other control
properties either based on the values supplied as parameters or on a
different function for each theme. It requires a bit of ingenuity but
at least the end result will be more system friendly and supportable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top