2017-09-03 79 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

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