WPF - Get combobox checked property from ListBox
Posted
by Chris Klepeis
on Stack Overflow
See other posts from Stack Overflow
or by Chris Klepeis
Published on 2010-05-20T14:27:40Z
Indexed on
2010/05/20
14:30 UTC
Read the original article
Hit count: 257
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?
© Stack Overflow or respective owner