Which is best way to organize resource files in an application? Currently in my application my resources are added inside an ResourceLib project which has this structure:
Color [folder]
StyleResource[Folder]
HeaderStyle [folder]
This list will keep on increasing as the day progresses.
In the App.xaml i am referencing this Library and merging these dictionary file for one time initialization. DynamicResource is used to support theme facility.
Will there be any performance impact if continue with this structure?. Is there any advantage or performance impact if i put all these xaml in to one resource name (Style.xaml)?
What are the performance implications of a Style.xaml with 5000 lines versus splitting same into 10 different xaml files?
Finally, which is the best or accepted method?
The company I work for does a lot of WPF and Silverlight work. I've developed an organization structure that we now use on all projects. That structure and write-up can be found here:
http://projekt202.com/blog/2010/xaml-organization/
I am not sure if you will gain any performance as everything gets piled up in one big dictionary object anyways. Even if there is any gain at all, don't go for it. The maintainability you get in having different xaml is hard to trade off.
Having said this DynamicResource
is a performance hungry operation, you might have to Freeze
brushes and images wherever possibe. Add:
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
<SolidColorBrush x:Key="HeaderBrush" Color="Black" PresentationOptions:Freeze="True"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With