Home > Mobile >  Are MergedDictionaries parsed every time?
Are MergedDictionaries parsed every time?

Time:01-03

Consider a WPF UserControl which defines the following resources:

<UserControl.Resources >
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="LeftHeaderDataTemplates.xaml"/>
            <ResourceDictionary Source="RightHeaderDataTemplates.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</UserControl.Resources>

Will the merged resources be parsed for every instance of the user control? The Application Time Line in the Performance Profiler appears to indicate so, but I'm not sure, if I'm reading the results correctly.

CodePudding user response:

Yes - it will.
And even more. If you set a DynamicResource, then this will work similar to a binding. When you change the resource, replace the dictionary, change the level of the resource - the value of DynamicResource will be re-evaluated.

  • Related