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:
Thx, Christoph
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
Hi again!
Thank you very much for your help. It works perfectly for me.
Now I will adjust the Styles to set my own tooltips for the filter area and so.
What additional question:
When you add a simply property UInt32 to the CustomObject in the ViewModel and enter a value of -5 you receive a default error message
Is there an easy way to override this error message!?
I found now property used to set this error message. Thought about using the PropertyItemValueChanging event, but this event is not raised when this error message pops up.
Do I need to write a custom type-converter to handle this?!
One of my next steps will also be to consider Validation Errors in the Property Grid. My model bound to this grid implements INotifyDataErrorInfo and I want to use the defined validation rules to show specific errors in the grid when the user enters an invalid value.
BR, Christoph