我有以下(非常简单的)ItemsControl:
<ItemsControl Name="BlahList" ItemsSource="{Binding Blah}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox Name="MyCheckBox" Content="{Binding Text}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
在代码中,我想做以下事情:
foreach (var dahCurrentItem in BlahList.Items)
{
var ItemCheckBox = BlahList.GimmeMyControl(dahCurrentItem, "MyCheckBox")
// I'm going to do something with the check box here...
}
我怎么做?