So I'm using a class library called MyControls.dll in this I have set up a few themes: Generic.xaml (where my controls appear regular), GenericBlue.xaml (where my controls appear blue), etc.
When I use this class library it picks Generic.xaml automatically. My question is can I somehow manually pick which GenericXXX.xaml to pick. I'd like some programs to appear a certain colo开发者_如何学编程r, and some other programs to appear in another color, etc.
You could also manipulate the application's resources at run-time in code and add a xaml file. If you use DynamicResource bindings it will allow you to switch styles/templates at will.
You can make a resource dictionary at Application level out of your themes, as
<Application.Resources>
<ResourceDictionary Source="GenericBlue.xaml"/>
</Application.Resources>
If you do this, your control library generic will be ignored, and your application will pick this theme to define the look-and-feel of your controls defined in your library!
精彩评论