I am binding to an ObservableCollection<Stage>
Stages as the ItemsSource for an ItemsControl:
<ItemsControl ItemsSource="{Binding Path=Stages}">
Is there any way to pass the current stage object to a usercontrol in an item datatemplate like this:
<ItemsControl ItemsSource="{Binding Path=Stages}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:Stage}">
<local:MyUserControl CustomDependencyProperty="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
The real problem is I need to have the current Stage object to be a variable in MyUserControl to do some work on it. Passing it to the constructor [like: MyUserControl(Stage s)] seems like a good way of doing it but afaik there is no way to specify that in XAML. Any ideas?