我想我会使用Mahapps.Metro尝试一些 WPF Metro并遇到错误:
在 MetroWindow 类型中找不到可附加属性 WindowCommands
我已经包含了来自 nuget 的包并具有以下 xaml:
<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();
}
}
}
我正在尝试获得类似于此处文档中的标题栏。
有任何想法吗?