Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Issue with changing the style of XamPropertyGrid
posted

Hi!

I am having an issue with changing the style of the XamPropertyGrid.

I am using Infragistics 18.1.20181.324.

I took an example from the thread

https://www.infragistics.com/community/forums/f/ultimate-ui-for-wpf/110051/default-property-grid-editors

PropertyGridDefaultEditorsCase.zip

and according to the thread

https://www.infragistics.com/community/forums/f/ultimate-ui-for-wpf/108746/xampropertygrid-description-area-display-an-image

I added the generic.shared.xaml file.

This file is located under the C:\Program Files (x86)\Infragistics\2018.1\WPF\DefaultStyles\PropertyGrid

to the solution and merged the resource dictionaries

<ResourceDictionary Source="Themes\generic.xaml" />

in MainWindow.xaml.

Nothing else.

The original looks like this

When you hover over the items it is gray backcolor and black forecolor.

A selected item is blue backcolor and white forecolor.

The modified example, shows a gray backcolor and a black forecolor when you hover:

but as soon as you select an item the selected item has blue backcolor and white forecoler and all other items switch to white forecolor:

and hovering over the items:

I took a look at generic.shared.xaml  and the line which causes the troubles is in Style

PropertyGridPropertyItemView

line no. 771

<ColorAnimation Duration="0" To="White" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="displayName"/>

if this line is commented the text stays black, but looks not so fine when it is selected:

I was not able to fix this myself.

Main intention is to adjust the some colors, some other visual items and the PropertyGridDescriptionAreaControl .

I've attached the modified project:

PropertyGridDefaultEditorsCase.zip

Thx, Christoph

Parents
No Data
Reply
  • 33490
    Verified Answer
    Offline posted

    Hello Christoph,

    I have been investigating into this behavior you are seeing with the XamPropertyGrid, and I am able to reproduce this with the sample project you sent. If this generic.shared.xaml file is the same one as from the default theme for the XamPropertyGrid, I would not expect that inclusion of it would cause this problem, but I have devised a workaround in this case. It is also worth noting that I have tested this against the latest versions (2019.1) where I do have the default styles installed on my local machine, and this behavior does not happen.

    My workaround in this case is to comment out all of the VisualStateManager.VisualStateGroups in the default style for PropertyGridPropertyItemView, and essentially rebuild them using triggers for the ControlTemplate.Triggers collection. I am rather unsure why this works and the VisualStateManager.VisualStateGroups don’t in this case, but this is working as expected on my end, and I am attaching a modified version of the sample project with this workaround applied.

    Being that this does not happen with the latest versions of 2018.2 and 2019.1, this leads me to believe that this could have been a bug in the handling of the VisualStateManager for the XamPropertyGrid in the 2018.1 version you are using. As such, this workaround should work for you.

    Please let me know if you have any other questions or concerns on this matter.

    5127.PropertyGridDefaultEditorsCase.zip

Children