Closed midspace closed 3 years ago
Hi,
Thank you for the sample. If I run it with Toolkit v4.1, and click on "Items" dropdown, I can see the CollectionControl. Then, If I click the "Add" button, I can see a new MainItem in the PropertyGrid of the CollectionControl with a Green border for the "Name" property.
What exactly is the problem ? Thank you
As explained, the issue is with the collection in the sub item
This sample has the PropertyValueChanged event notification connected and displayed at the bottom of the main window. If you make a change in any of the properties, it should display "true" Clicking on the "clear changes" button will change it back to "false" It the collection under the Sub Item, none of the changes in it will trigger the PropertyValueChanged event.
Hi, Thank you for the explanations and screenshots. The issue has been identified and will be fixed in v4.3.
In the meantime, you can go in file Xceed.Wpf.Toolkit/PropertyGrid/Implementation/Editors/CollectionEditors.cs, 1) In method SetControlProperties() and Editor_CollectionUpdated() Replace the lines: var propertyGrid = propertyItem.ParentElement as PropertyGrid; by; var propertyGrid = this.GetParentPropertyGrid( propertyItem.ParentElement );
2) Add the following method: private PropertyGrid GetParentPropertyGrid( FrameworkElement element ) { var propertyGrid = element as PropertyGrid; if( propertyGrid == null ) { var parentPropertyItem = element as PropertyItem; while( ( parentPropertyItem != null ) && ( propertyGrid == null ) ) { propertyGrid = parentPropertyItem.ParentElement as PropertyGrid; if( propertyGrid == null ) { parentPropertyItem = parentPropertyItem.ParentElement as PropertyItem; } } }
return propertyGrid;
}
This will search the ancestor of type PropertyGrid to fix the issue for sub-Properties. This will all be part of v4.3. Thank you
The PropertyGrid is not applying Editor Definitions or receiving PropertyValueChanged event notifications from certain parts of a complex model. Tested with version 4.1
This is a basic pseudocode of the model. Properties in Model5 do not trigger the PropertyValueChanged event, and do not apply the EditorTemplateDeninifion.
Find attached a working sample of the code. WpfApp1-xceed propertygrid bugs.zip