Dynamically swap out nested properties at runtime

Hi

So I am using the MVVM pattern and displaying a ViewModel with bunch of properties in a sfPropGrid. One of the properties is a nested property (with a bunch of child properties) and needs to be swapped out at runtime when one of the other properties gets updated. The problem I'm having is that the Propgrid does not display the new nested properties. When I add a button to manually refresh the sfPropGrid in code behind it displays the correct nested properties. It seems that the propgrid is not refreshing when the nested properties are swapped out. I tried running INotifyPropertyChanged when they are swapped but with no luck. I somehow need to call Refresh on the PropGrid when that nested prop is swapped out.  Or if you have any other suggestions please let me know. 


1 Reply

GT Gokul Thanudhas Syncfusion Team September 12, 2022 03:30 PM UTC

Hi Gerrit,


The PropertyGrid control has the limitation that the configuration of the PropertyGrid cannot be changed at the runtime. If you want to change the configuration at runtime you need to call RefreshPropertyGrid method.


But, We are unable to understand exact requirements of yours. Please provide us with more information about your requirement so that we can provide a better solution.


For reference, we have created a simple sample in which we have changed the property of the Nesteditem in the ValueChanged event. Please refer to the sample and video for your reference. Please share the modified sample based on your requirement, so that we can prompt the solution further.


Regards,

Gokul T


Attachment: PropertyGrid_23f0c0da.zip

Loader.
Up arrow icon