I have an Itemscontrol in my xaml, and I am calling a user control in the DateTemplate of ItemsControl like following
<ScrollViewer Margin="0,0,0,0" BorderThickness="0"> <ItemsControl x:Name="itemsStackPanel"> <ItemsControl.ItemTemplate> <DataTemplate> <controls:UserItem Margin="0, 5, 0, 3"></controls:UserItem> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </ScrollViewer>
I already assign a list to ItemsControl.
this.itemsStackPanel.ItemsSource = usersList;
and now I want to pass something extra property to my user control, which is inside DataTemplate, something like following, how do I do that?
<controls:UserItem Margin="0, 5, 0, 3" CurrentColumnInfo={Binding oColumnInfo}></controls:UserItem>
the oColumnInfo object is kept in the codebehind. how do I pass that to each user item?