2015-01-13 74 views
0

我在wpf中很新。我想在windows8中有一個類似應用程序(右側)窗口的彈出窗口。使用的NuGet來mahapps(http://mahapps.com)添加到我的項目和資源添加到應用程序,但是當一個彈出添加窗口,我得到這個錯誤:mahapps:在'MetroWindow'類型中未找到可附加屬性'Flyouts'

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

嘗試刪除「MetroWindow.Flyout」 ......

<controls:FlyoutsControl> 
      <controls:Flyout Position="Bottom"> 
         // .. some controls .. 
      </controls:Flyout> 
</controls:FlyoutsControl> 
+0

謝謝您的回答你的建議我刪除「MetroWindow」,但它不到風度工作,複製並粘貼您的代碼和它的工作!? ???但爲什麼? – user4002899

+0

這是因爲這 - xmlns:controls =「http://metro.mahapps.com/winfx/xaml/controls」...名稱空間區分大小寫 – aggietech

+0

再次感謝您。我從MahApps複製這段代碼,但是當我輸入它並讓VS完成小寫字母並做功時。 – user4002899

相關問題