2017-09-03 80 views
13

首先,非常感謝MahApps。多麼酷的項目!MahApps和Property Grid

我有一個現有的應用程序用WPF編寫,我已經將MahApps庫應用到了。我用這個教程:

http://mahapps.com/guides/quick-start.html

但是在屬性網格(Xceed)的影響是最小的。

我在其他窗口的組合框這個樣子:

enter image description here

屬性網格組合框還是這個樣子(醜陋!):

enter image description here

但是點擊組合框顯示項目的正確MahApps樣式。只有組合框本身(封閉)不平坦。

enter image description here

我的WPF的知識是基本的。我會在哪裏嘗試解決這個問題?我是否需要手動覆蓋屬性網格中的組合框模板?

+0

你可以嘗試其他屬性網格:https://github.com/SoftFluent/SoftFluent.Windows(免責聲明:我寫了它,它是免費的&開源的)也許他們與mahapps沒有太多的努力集成。 –

+0

因此,醜陋的東西有點兒主觀,但一個快速的建議是,mahapps可以結合材料設計來創建一些非常棒的開箱即用用戶體驗(包括網格):http://materialdesigninxaml.net –

回答

3

也許你的其他組合框看起來很醜,因爲找不到MahApps資源?

將您正在使用的mahapp資源放在App.xaml文件的資源字典中,以便所有窗口都可以訪問它。 (而不是將它們放置在一個資源字典中只有一個窗口,即mainwindow.xaml。)

的App.xaml:

<Application... > 
<Application.Resources> 
    <ResourceDictionary> 
     <!-- My other resources --> 
     <!-- ... --> 

     <!-- MahApps resources --> 
     <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/Controls.AnimatedSingleRowTabControl.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Application.Resources> 

+0

我已經更新了這個問題。這不是我的問題。當組合框打開時,您可以在新圖片中看到正確的樣式。問題在於組合框關閉時。組合框需要平坦 – user1035217

+0

哦,我明白了..你是否定義了自己的