WPF SharedResourceDictionary

前端 未结 3 1578
闹比i
闹比i 2021-01-16 07:45

I have used a custom class to implement shared resource functionality in my WPF application this is a sample code to create and manage dictionaries

public cl         


        
3条回答
  •  抹茶落季
    2021-01-16 07:52

    I know this issue is old and solved, but as I have been working on an alternative solution with a friend, I wanted to share it:
    1. Use the WPF ResourceDictionary everywhere in xaml, this way Blend and the VS designer does not break.
    2. Reference nuget packages Sundew.Xaml.Optimizations and Sundew.Xaml.Optimizer
    3. Add a sxo-settings.json in the root of your project and enable the ResourceDictionaryCachingOptimizer
    4. Build
    The build will use a caching/shared ResourceDictionary.

    For more details see: https://github.com/hugener/Sundew.Xaml.Optimizations
    And the sample: https://github.com/hugener/Sundew.Xaml.Optimizer.Sample

提交回复
热议问题