简体   繁体   中英

How to change background/Foreground in an Extended Toolkit PropertyGrid

I have a Extended Wpf Toolkit propertyGrid:

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

and here is what it looks like:

在此处输入图片说明

So it's pretty clear that the background doesn't entails the rows which are therefore independent.

That said I have seen that by adding

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

I am able to change some of the lines (not all) but I need to do that programmatically through code-behind.

This is what I'd like to achieve:

在此处输入图片说明

Thanx

Styling the WPF PropertyGrid has an example at:

https://gist.github.com/Tide

Save the PropertyGrid.xaml to your project, and in App.xaml add

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

inside:

    <ResourceDictionary>

    </ResourceDictionary>

Probably the best approach is using a Theme as shown on the old CodePlex site:

https://wpfpropertygrid.codeplex.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM