C# Metro:在MetroWindow类型中找不到可附加属性WindowCommands
我想我应该尝试使用一些WPF Metro,但遇到了以下错误: 在MetroWindow类型中找不到可附加属性WindowCommands 我已经包含了nuget的包,并具有以下xaml:C# Metro:在MetroWindow类型中找不到可附加属性WindowCommands,c#,wpf,wpf-controls,C#,Wpf,Wpf Controls,我想我应该尝试使用一些WPF Metro,但遇到了以下错误: 在MetroWindow类型中找不到可附加属性WindowCommands 我已经包含了nuget的包,并具有以下xaml: <Controls:MetroWindow x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="htt
<Controls:MetroWindow x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Controls:MetroWindow.WindowCommands>
<Controls:WindowCommands>
<Button Content="settings" />
</Controls:WindowCommands>
</Controls:MetroWindow.WindowCommands>
<Controls:MetroContentControl>
<Button Content="Blah" Height="20" Width="150" />
</Controls:MetroContentControl>
</Controls:MetroWindow>
以及背后的代码:
using MahApps.Metro.Controls;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : MetroWindow
{
public MainWindow()
{
InitializeComponent();
}
}
}
使用MahApps.Metro.Controls;
命名空间WpfApplication1
{
///
///MainWindow.xaml的交互逻辑
///
公共部分类主窗口:MetroWindow
{
公共主窗口()
{
初始化组件();
}
}
}
我正在尝试获取与文档中的标题栏类似的标题栏
有什么想法吗?构建您的项目
你的代码看起来不错。在添加引用之后,您可能还没有构建项目。
此错误是否仍然存在?生成您的项目
你的代码看起来不错。在添加引用之后,您可能还没有构建项目。
这个错误仍然存在吗?代码运行良好,只是有点拼写错误。 更改为:
据此:
该代码运行良好,您只是拼错了一点。
更改为:
据此:
它似乎在我的另一台电脑上工作,所以猜测我的VS坏了(未受抑制)它似乎在我的另一台电脑上工作,所以猜测我的VS坏了(未受抑制)