Set up application resources from code

后端 未结 3 843
情话喂你
情话喂你 2020-12-14 07:29

I have a c# project that was a WPF application but I now want to build it as a dll. I have previously done this by removing the app.xaml from the project and setting its bui

3条回答
  •  无人及你
    2020-12-14 07:58

    I think you need to specified the name of the component were the resource is sitting in

    
    

    If your dll is named My.Wpf.Component.dll you should put My.Wpf.Component

    so in code it should be

    Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"/;component/Resources/Styles/Shared.xaml", UriKind.Relative) });
    

提交回复
热议问题