【问题标题】:How to change background/Foreground in an Extended Toolkit PropertyGrid如何在扩展工具包 PropertyGrid 中更改背景/前景
【发布时间】:2016-12-05 14:27:11
【问题描述】:

我有一个扩展的 Wpf 工具包 propertyGrid:

<wpg:PropertyGrid x:Name="pg" Width="450" Height="300" Margin="10" ShowSearchBox="False"  Background="Transparent" >

这是它的样子:

因此很明显,背景并不包含因此独立的行。

也就是说,我已经通过添加看到了这一点

<wpg:PropertyGrid.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Red" />
        </wpg:PropertyGrid.Resources>

我可以更改某些行(不是全部),但我需要通过代码隐藏以编程方式进行。

这就是我想要实现的目标:

感谢

【问题讨论】:

    标签: c# background propertygrid foreground wpf-extended-toolkit


    【解决方案1】:

    样式化 WPF PropertyGrid 有一个示例:

    https://gist.github.com/Tide

    将 PropertyGrid.xaml 保存到您的项目中,并在 App.xaml 中添加

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="PropertyGrid.xaml" />
            </ResourceDictionary.MergedDictionaries>
    

    内部:

        <ResourceDictionary>
    
        </ResourceDictionary>
    

    可能最好的方法是使用旧 CodePlex 网站上显示的主题:

    https://wpfpropertygrid.codeplex.com

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-31
      • 2011-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-05
      • 1970-01-01
      相关资源
      最近更新 更多