App.xaml指向子文件夹中的库

时间:2018-08-14 19:59:07

标签: c# wpf dll app.xaml material-design-in-xaml

我正在使用material design XAML toolkit库,该库当前在app.xaml中,我具有:

<?xml version="1.0" encoding="UTF-8"?>
<Application . . .>
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Application.Resources>
</Application>

但是,我使用pretty-bin将库移动到/ lib子文件夹中,因此它不再能够找到资源目录。我正在努力找出正确的语法,该如何从子文件夹引用这些文件。谢谢。

编辑

enter image description here

代码

  <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;/component/lib/Themes/MaterialDesignTheme.Light.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/lib/Themes/MaterialDesignTheme.Defaults.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/lib/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/lib/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/lib/Themes/MaterialDesignTheme.Flipper.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/lib/Themes/MaterialDesignColor.Indigo.Named.xaml" />
        </ResourceDictionary.MergedDictionaries>

编辑2

enter image description here

1 个答案:

答案 0 :(得分:2)

我设法找到了答案,我需要编辑App.config文件并将其放在里面:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="lib" />

我遵循了这个here

相关问题