0

我在 wpf 中很新。我想在 windows8 中有一个弹出窗口,如应用程序(右侧)窗口。使用 nuget 将 mahapps(http://mahapps.com)添加到我的项目并向应用程序添加资源,但是当向窗口添加弹出窗口时出现此错误:

    The attachable property 'Flyouts' was not found in type 'MetroWindow'

我的xml代码是:

    <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 文件中没有任何特殊的东西。我该如何解决这个错误?

4

1 回答 1

2

尝试删除“MetroWindow.Flyout”...

<controls:FlyoutsControl>
            <controls:Flyout Position="Bottom">
                      //  .. some controls .. 
             </controls:Flyout>
</controls:FlyoutsControl>
于 2015-01-13T22:08:03.150 回答