WPF - Get combobox checked property from ListBox
- by Chris Klepeis
I have a listbox, which is defined like so:
<ListBox ItemsSource="{Binding Source={x:Static local:ResourceCollection.resourceList}}" Height="143" HorizontalAlignment="Left" Margin="6,6,0,0" Name="assignmentLB" VerticalAlignment="Top" Width="287" FontSize="12" FontWeight="Normal" IsEnabled="True" Grid.Column="0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox />
<TextBlock Text="{Binding Content}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
How can I loop through this listbox and retrieve the TextBlock.Text value for only items whose Checkbox has been checked?