Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: PropertyGrid: Selection Color

$
0
0
Hi,

Are you looking to modify the highlight color (kind of light blue) ?

If so, you have to know that the PropertyGrid uses specific highlight color. For example, in the file
-Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml (in windows 8)
-Toolkit/PropertyGrid/Themes/Generic.xaml (in Windows 7)
There is a style for PropertyItemBase which has a trigger (IsMouseOver) that sets a Background color for the PART_NAME of a PropertyItem to ButtonMouseOverBackgroundKey.

The same way, the PART_VALUE, will be colored when the mouse is over, but this is an Editor (depending on the Type to edit). So for a PropertyGridEditorDoubleUpDown, it will be based on NumericUpDown, which has a trigger IsMouseOver that set the border to ControlMouseOverBorderKey.

The same way, the PART_VALUE, will be colored when the mouse is over, for a PropertyGridEditorTextBox, it will be based on WatermarkTextBox, which has a trigger IsMouseOver that set the border to ControlMouseOverBorderKey.

To change those values, you can do :
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes;assembly=Xceed.Wpf.Toolkit"

 <xctk:PropertyGrid   x:Name="_propertyGrid"
                               SelectedObject="{Binding ElementName=_button}">
               <xctk:PropertyGrid.Resources>
                  <!-- PART_NAME background Highlight-->
                  <SolidColorBrush x:Key="{x:Static themes:ResourceKeys.ButtonMouseOverBackgroundKey}"
                                   Color="Red" />
                  <!-- Numeric/TextBox Editor Highlight-->
                  <SolidColorBrush x:Key="{x:Static themes:ResourceKeys.ControlMouseOverBorderKey}"
                                   Color="Red" />
               </xctk:PropertyGrid.Resources>
            </xctk:PropertyGrid>

Viewing all articles
Browse latest Browse all 2157

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>