j_zhou
j_zhou

Reputation: 23

How to use PropertyGrid in Xceed.Wpf.Toolkit with cascade properties?

I wanna use the PropertyGrid to modify a certain property of an object loaded from json. But in my situation, some properties are instances of a class, which also has it own properties. I've tried to customize the editors to show those sub-properties:

<xctk:EditorTemplateDefinition TargetProperties="SystemParameter">
     <xctk:EditorTemplateDefinition.EditingTemplate>
          <DataTemplate>
               <Button Command="ExpandCommand" CommandParameter="{Binding Value}">...</Button>
          </DataTemplate>
     </xctk:EditorTemplateDefinition.EditingTemplate>
</xctk:EditorTemplateDefinition>

var win = new MainWindow();
win.SetSelectedObject(JsonConvert.DeserializeObject(e.Parameter.ToString()));
win.ShowDialog();

It works but I cannot commit the modification to the first-level window. As a result, if one changed a sub-property, I cannot save this modification.

My question is: How to use the [PropertyGrid] with cascade properties? Is my solution right? If yes, how to save the modifications to sub-properties?

Upvotes: 1

Views: 123

Answers (0)

Related Questions