Is there any way to use StaticResource in a WPF control library and be able to view at design-time?

前端 未结 3 1711
无人及你
无人及你 2021-02-04 00:29

I have a WPF Control Library that is being added to a windows forms application. We want to allow the controls to be localizable, however I am not sure how to FULLY accomplish t

3条回答
  •  伪装坚强ぢ
    2021-02-04 01:12

    I too had a problem dealing with Styling Themes and available static resources. So, I created a stand-alone library that basically had nothing but the themes to be used all nested like your MERGED resources of your prior linked question.

    Then, in the Windows form (.xaml), I just put reference to that library, something like

    
    
      
        
          
            
            
            
          
      
    
      
    
    
    

    The "component" appears to refer to the root of the given "MyLibrary" project. In the actual project, I created a subfolder called "Themes", hence the source includes... ;component/Themes/...

    The "MyMainThemeWrapper.xaml" is very much like your nested Merged Resource dictionaries, and it sees everything perfectly from other libraries.

提交回复
热议问题