2016-12-05 125 views
0

我有一个扩展的WPF工具包的PropertyGrid:如何改变背景/前景在扩展工具包的PropertyGrid

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

,这里是什么样子:

enter image description here

所以这是很清楚的背景并不需要独立的行。

不过我已经看到,通过增加

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

我能够改变一些线(不是全部),但我需要做的是通过编程代码隐藏。

这是想什么我实现:

enter image description here

感谢名单

回答

0

样式化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

+0

但我必须把它从代码隐藏改变。 .... – Luca