xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.9k stars 878 forks source link

RefreshProperties.All not working as I want #1769

Closed EdoardoNagliati closed 9 months ago

EdoardoNagliati commented 10 months ago

Hello, I am encountering a problem with the RefreshProperties.All attribute of the propertyGrid, which I have reproduced below in a simplified manner: basically, it seems to me that the refresh is called only when interacting with the checkBox. However, if I change the value of this externally through a button, it seems to me that the refresh is not called. How can I solve this? Thank you for your kind attention

Grid>

XceedBoucherS commented 9 months ago

Hi,

The RefreshProperties attribute is used to refresh the propertyGrid when a property has this attribute.

In your sample, in the CheckBox property setter, I suggest you place your OnPropertyChanged( nameof( CheckBox ) ); at the end of the setter. This will let the browsable attribute be set before starting the refresh process. When you uncheck the CheckBox, the binding on the editor is resolved a bit later. But, when you modify a SelectedObject's property from code-behind, the OnPropertyChanged is executed right away, before the browsable attribute gets set.

Thank you