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

标签 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

最佳答案

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

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

我关注了这个here

关于c# - App.xaml 指向子文件夹中的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51848938/

相关文章:

c# - 带有 C# Windows 窗体应用程序的 Oracle 即时客户端

c# - 无法将 RibbonTextBox isEnable 设置为 False

wpf - 根据可见性定义交替 TreeView 行的背景颜色

使用 OpenID 和 OAuth 的 youtube API(或 gdata API)的 c# 示例

Blend 2 sp1 中的 WPF 视觉状态管理器

wpf - 我如何在 XAML 中执行此操作?

java - 签名的 Applet、JNI 和 DLL

python - OpenCV-Python导入错误: DLL load failed: The specified module could not be found

c# - 在 Silverlight 中调用 Dispatcher.CheckAccess() 是好的形式吗?

c# - 保存 '&' 登录 Cookie