View Revisions: Issue #1379

Summary 0001379: New approach for loading ResourceDictionary similar to WPF's Application.Resources
Revision 2018-12-21 17:46 by ai_enabled
Description This feature will allow us to reduce the MergedDictionaries cross-referencing bloat we have in our ResourceDictionaries by referencing all of them in a single ResourceDictionary similar to how WPF's Application.Resources works. Supposedly, it will also improve loading times, performance and memory usage due to fewer resources duplication.


Feature explanation:
In WPF it's possible to reference any resource from Style1.xaml from Style2.xaml if they're both referenced from the Application ResourceDictionary (via MergedDictionaries). So Style2.xaml doesn't need to have a MergedDictionaries entry for Style1.xaml. (please see the attached WPF project source demonstrating this approach)

However, it's impossible to use with NoesisGUI due to API limitations. When NoesisGUI loading Resources.xaml via GUI.LoadXaml(pathToFile) it starts loading all the merged MergedDictionaries one by one - Style1.xaml, then Style2.xaml. And here an exception happens as Style2.xaml references some static resource from Style1.xaml and NoesisGUI cannot locate it.

A special API is required to allow this scenario. For example:
<code>
var applicationResourceDictionary = GUI.LoadApplicationResourcesXaml("Resources.xaml");
GUI.SetApplicationResources(applicationResourceDictionary);
</code>

Regards!
Revision 2018-12-21 17:45 by ai_enabled
Description This feature will allow us to reduce the MergedDictionaries cross-referencing bloat we have in our ResourceDictionaries by referencing all of them in a single ResourceDictionary similar to how WPF's Application.Resources works. Supposedly, it will also improve loading times, performance and memory usage due to fewer resources duplication.


Feature explanation:
In WPF it's possible to reference any resource from Style1.xaml from Style2.xaml if they're both referenced from the Application ResourceDictionary (via MergedDictionaries). So Style2.xaml doesn't need to have a MergedDictionaries entry for Style1.xaml. (please see the attached WPF project source demonstrating this approach)

However, it's impossible to use with NoesisGUI due to API limitations. When NoesisGUI loading Resources.xaml via GUI.LoadXaml(pathToFile) it starts loading all the merged MergedDictionaries one by one - Style1.xaml, then Style2.xaml. And here an exception happens as Style2.xaml references some static resource from Style1.xaml and NoesisGUI cannot locate it as it was not populated to anywhere.

A special API is required to allow this scenario. For example:
<code>
var applicationResourceDictionary = GUI.LoadApplicationResourcesXaml("Resources.xaml");
GUI.SetApplicationResources(applicationResourceDictionary);
</code>

Regards!