tags:

views:

64

answers:

1

I have a custom control I'm developing that has a collection of items. When adding an item to the collection you're meant to do:

myCustomControl.BeginAddItems();
  myCustomControl.Items.Add("a");
  myCustomControl.Items.Add("b");
  myCustomControl.Items.Add("c");
myCustomControl.EndAddItems();

If defining in xaml it would be:

<MyControl>
  <Items>
    <Item Name="a" />
    <Item Name="b" />
    <Item Name="c" />
  </Items>
</MyControl>

How can I have EndAddItems (and ideally BeginAddItems) called when loading from xaml? Is there any way that MyControl can be notified by xaml that it has finished loading?

+1  A: 

You can use the Loaded event

Thomas Levesque