if i define two default styles for two different controls in one custom control lib i get errors...
is it possible to have two or more controls with a default generic.xaml in one lib?
Thanks
if i define two default styles for two different controls in one custom control lib i get errors...
is it possible to have two or more controls with a default generic.xaml in one lib?
Thanks
Yes, it is possible. The recommended approach is to place styles for each control in its own resource dictionary and have one Generic.xaml file that will reference others.
So, for example, if you have two controls in your library: MyControl1 and MyControl2. Then you will have the following files in the Themes
folder of your project:
And your generic.xaml will look like this:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MyControlLib;component/Themes/MyControl1.generic.xaml" />
<ResourceDictionary Source="/MyControlLib;component/Themes/MyControl2.generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Yes.
Not only is it possible, it is the default behavior.
This is, of course, assuming that the two controls are in the same namespace.
You don't specify the error(s) that you are getting, so I can't offer much more detail.