Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: Use a CollectionControl as an EditingTemplate.

$
0
0
I'm using the PropertyGrid with a good deal of success. However, I'd like to change the behavior of the CollectionControl. Instead of having a new dialog appear for collections, I'd like to embed the CollectionControl directly into my PropertyGrid.

Suppose I have:
public class AddressBook
{
public string Owner { get; set; }
public bool IsUpToDate { get; set; }
public List<People> People { get; set; }
}

public class People
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
When I select the property People from AddressBook, rather than have a separate dialog show up, I'd like the CollectionControl template to appear inline with Owner and IsUpToDate.

I tried to do this with an Editing Template:
<xctk:PropertyGrid.EditorDefinitions>
  <xctk:EditorTemplateDefinition TargetProperties="People">
    <xctk:EditorTemplateDefinition.EditingTemplate>
      <DataTemplate>
        <xctk:CollectionControl ItemsSource="{Binding Value}" />
      </DataTemplate>
    </xctk:EditorTemplateDefinition.EditingTemplate>
  </xctk:EditorTemplateDefinition>
</xctk:PropertyGrid.EditorDefinitions>
This LOOKED the way I wanted it to, but I noticed that any changes I made to People (adding people, removing people, changing the properties of a People object) were not saved back to my source.

Any suggestions? Is this even possible/recommended?

Thanks!

Viewing all articles
Browse latest Browse all 2157

Trending Articles



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