3
Answers

ListBox.ItemTemplate Can I tell if a checkbox is checked.

Ray Beattie

Ray Beattie

10y
1k
1
Here is the ListBox.ItemTemplate:
<!-- This is the listbox-->
<ListBox Name="lbTodoList" Grid.Row="3" Background="AliceBlue" HorizontalContentAlignment="Stretch" SelectionChanged="lbTodoList_SelectionChanged" KeyDown="lbTodoList_KeyDown">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="1,2,2,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<CheckBox x:Name="chkBox" FontWeight="Bold" Content="{Binding TrackRace}" Checked="chkBox_Checked"/>
<TextBlock Grid.Column="1" FontWeight="Bold" HorizontalAlignment="Right" Text="{Binding RaceTime}"
/>
<TextBlock Grid.Row="1" Text="{Binding RaceDist}"/>
<TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Text="{Binding RaceClass}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
 All items load ok and I can get the items out when item in listbox is selected.   I just do not know how to tell if the checkbox is checked or how to make it check.   I hope someone can help.  If you need more info on this let me know.
Thanks In Advance:
 
Ray
 
 
 

Answers (3)
Next Recommended Forum