c# - MahApps 和属性网格

标签 c# wpf mahapps.metro

首先,非常感谢 MahApps。多么酷的项目!

我有一个用 WPF 编写的应用程序,我已经应用了 MahApps 库。我使用了本教程:

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

然而,对 Property Grid (Xceed) 的影响很小。

我的其他窗口中的组合框如下所示:

enter image description here

属性网格组合框看起来仍然像这样(丑陋!):

enter image description here

但是,单击组合框会显示项目的正确 MahApps 样式。只有组合框本身(闭合的)不是平面的。

enter image description here

我对 WPF 的了解很基础。我应该从哪里开始尝试解决这个问题?我是否需要手动覆盖属性网格中的组合框模板?

最佳答案

in MainWindow.xaml use Controls:MetroWindow

<Controls:MetroWindow x:Name="MainApp" x:Class="AppWin.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      MinHeight="700"
                      MinWidth="1024"
                      >

in MainWindow.xaml.cs inheritance MetroWindow

namespace AppWin
{
    public partial class MainWindow : MetroWindow
    {
  ...

add App.xaml following settings

    <Application x:Class="AppWin.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:local="clr-namespace:AppWin"
                 StartupUri="MainWindow.xaml">
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />

/*--change template color for example green.xaml--*/
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/red.xaml" />

/*--change template style for example BaseDark.xaml--*/
                    <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />

                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Application.Resources>
    </Application>

关于c# - MahApps 和属性网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46023054/

相关文章:

c# - Visual Studio 的 Outlook 对象库

c# - 我们如何将自定义 UserControl 关闭为对话框?

c# - 在显示另一个之前隐藏所有可见的 Metro 对话框

c# - 使结束日期值在用户输入开始日期并考虑闰年后准确显示 1 年

c# - awesomium 网络浏览器上的触摸事件

wpf - MahApps Metro 捕获关闭窗口事件

c# - MahApps Metro - 将过渡应用到选项卡控件

c# - 如何转换或应用转换到绑定(bind)到 WPF 中的 gridviewcolumn 的字符串

c# - ACE.OLEDB 提供程序错误地读取了一些列名称

c# - REST API(ASP.NET Web API 2)最佳实践: How to return 1 - N items that are not one type but 3 related types?