Is there any event fired when a DataTemplate has been initiated in WPF?
Posted
by Shimmy
on Stack Overflow
See other posts from Stack Overflow
or by Shimmy
Published on 2010-04-11T09:08:09Z
Indexed on
2010/04/11
19:13 UTC
Read the original article
Hit count: 567
Hello!
Take a look at the following xaml:
<ListBox ItemsSource="{Binding}">
<ListBox.Resources>
<CollectionViewSource x:Key="CVS"/>
</ListBox.Resources>
<ListBox.DataTemplate>
<DataTemplate OnBinding="myBinding">
<ListBox DataContext="{StaticResource CVS}" ItemsSource="{Binding}" />
</DataTemplate>
</ListBox.DataTemplate>
</ListBox>
So I can handle the binding and manually retrieve the CVS and set its Source property to my custom stuff according to the DataTemplate's DataContext.
Or else there is a different way in doing it. Any ideas are welcommed!
© Stack Overflow or respective owner