- leonid_golovko
- Posts: 13
- Joined:
Initiate user control in xaml
Code: Select all
<ItemsControl x:Name="IncisionsItemsControl" ItemsSource="{Binding Incisions}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:IncisionUserControl DataContext="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
-
sfernandez
Site Admin
- Posts: 3112
- Joined:
Re: Initiate user control in xaml
The user control specified in an ItemsControl item template will be instantiated for each item in the collection, and Initialized or Loaded events will be raised for each of the instantiated user controls.
What kind of extra initialization do you need to perform on your user control? The control should have the data context with the item view model set, so it has access to all the properties defined in the item view model.
What kind of extra initialization do you need to perform on your user control? The control should have the data context with the item view model set, so it has access to all the properties defined in the item view model.
Who is online
Users browsing this forum: No registered users and 3 guests