【发布时间】:2015-12-01 15:35:12
【问题描述】:
我在我的 XAML 代码中为 Visual Studio Extension 中的工具箱使用 MahApps.Metro 控件。我通过 NuGet 安装了这个包,然后我尝试在我的 XAML 标记中添加一个控件。下面是代码sn-p。
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:custom="http://metro.mahapps.com/winfx/xaml/controls"
x:Class="AutoDebug.MyControl"
Background="{DynamicResource VsBrush.Window}"
Foreground="{DynamicResource VsBrush.WindowText}"
mc:Ignorable="d"
d:DesignHeight="500" d:DesignWidth="400"
DataContext="{Binding UserControlModel}"
x:Name="AutoDebugWindow">
<Grid Margin="15">
<custom:Tile Content="Tile" HorizontalAlignment="Left" Margin="75,150,0,0" VerticalAlignment="Top" Background="#FF8B00BF"/>
</Grid>
</UserControl>
但无论如何我都会收到以下错误。
在 PresentationFramework.dll 中发生了“System.Windows.Markup.XamlParseException”类型的第一次机会异常
附加信息:无法加载文件或程序集“MahApps.Metro,PublicKeyToken=null”或其依赖项之一。系统找不到指定的文件。
我已经尝试安装/卸载、删除/添加引用,但到目前为止没有任何效果。
【问题讨论】:
-
阅读快速入门文档,您应该可以使用它:mahapps.com/guides/quick-start.html
-
我已按照步骤操作。但这无济于事。同时添加代码供参考。
-
@shahzad Visual Studio Extension 似乎没有加载 MahApps dll...
-
@punker76 是的,看起来是这样。但我无法弄清楚为什么
-
@shahzad- 已解决您的问题。是的,那么请。
标签: wpf xaml visual-studio-extensions mahapps.metro