Tutorial :How to know when a XAML element is finished loading


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?


You can use the Loaded event

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »