Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Use a CollectionControl as an EditingTemplate.

$
0
0
Hi,

The changes done in the CollectionControl are saved in the source when the OK button from the CollectionControlDialog is pressed.
You can save the changes by calling CollectionControl.PersistChanges() when items are added, deleted...
<xctk:PropertyGrid.EditorDefinitions>
<xctk:EditorTemplateDefinition TargetProperties="People">
           <xctk:EditorTemplateDefinition.EditingTemplate>
              <DataTemplate>
                 <xctk:CollectionControl ItemsSource="{Binding Value}"
                                         ItemAdded="CollectionControl_Action"
                                         ItemDeleted="CollectionControl_Action"
                                         ItemMovedDown="CollectionControl_Action"
                                         ItemMovedUp="CollectionControl_Action"/>
              </DataTemplate>
           </xctk:EditorTemplateDefinition.EditingTemplate>
        </xctk:EditorTemplateDefinition>
</xctk:PropertyGrid.EditorDefinitions>

private void CollectionControl_Action( object sender, Xceed.Wpf.Toolkit.ItemEventArgs e )
{
  var collectionControl = sender as CollectionControl;
  if( collectionControl != null )
  {
    collectionControl.PersistChanges();
  }
}

Viewing all articles
Browse latest Browse all 4964


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>