Thursday, November 8, 2018

[WPF/XAML] Is there a better way to handle many styles?

I am working on an application where I have a large number of custom styles and control templates. I defined them in a set of isolated files to make them more manageable, and to include them all in my application resources I am doing this:

<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/interfaces/styles/Theme.xaml" /> <ResourceDictionary Source="/interfaces/styles/Borders.xaml" /> <ResourceDictionary Source="/interfaces/styles/Button.xaml" /> <ResourceDictionary Source="/interfaces/styles/Checkbox.xaml" /> <ResourceDictionary Source="/interfaces/styles/ComboBox.xaml" /> <ResourceDictionary Source="/interfaces/styles/Labels.xaml" /> <ResourceDictionary Source="/interfaces/styles/ListBoxItem.xaml" /> <ResourceDictionary Source="/interfaces/styles/RadioButton.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> 

But the more files I add, the more it feels like the wrong solution. Is there some obvious mechanism that I am missing, maybe?

[WPF/XAML] Is there a better way to handle many styles? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team