我是wpf的新手。我想在windows8中有一个像应用程序(右侧)窗口的弹出窗口。使用nuget将mahapps(http://mahapps.com)添加到我的项目中并向应用程序添加资源但是当向窗口添加一个弹出窗口时我收到此错误:
The attachable property 'Flyouts' was not found in type 'MetroWindow'
我的xaml代码是:
<controls:MetroWindow x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
Title="MainWindow"
Height="600"
Width="800" WindowState="Maximized">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.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.Flyouts>
<Controls:FlyoutsControl>
<Controls:Flyout Header="Flyout" Position="Right" Width="200">
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<!-- some content -->
在cs文件中没有任何特殊的东西。我怎么能修复这个错误?
答案 0 :(得分:2)
尝试删除“MetroWindow.Flyout”......
<controls:FlyoutsControl>
<controls:Flyout Position="Bottom">
// .. some controls ..
</controls:Flyout>
</controls:FlyoutsControl>