Simple question though. I have a WPF application (.NET 4.0). There is a listbox which contains a number of userpanels. Each of these userpanels contains a checkbox.
When running you can click any portion of the userpanel except the checkbox itself and the listbox will select that row (which is indicated visually by the background changing in this simple case). If you check the box the row is not selected.
Requirement: If you check the checkbox, this should count as selecting the row.
Checkbox Control:
<UserControl x:Class="CheckboxClickExample.CheckboxControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="189" d:DesignWidth="221">
<Grid>
<CheckBox Content="CheckBox" Height="16" HorizontalAlignment="Left" Margin="10,10,0,0" Name="checkBox1" VerticalAlignment="Top" />
</Grid>
</UserControl>
Main Window:
<Window x:Class="CheckboxClickExample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:checkboxsample="clr-namespace:CheckboxClickExample"
Title="MainWindow" Height="350" Width="525">
<ListBox>
<checkboxsample:CheckboxControl/>
<checkboxsample:CheckboxControl/>
<checkboxsample:CheckboxControl/>
<checkboxsample:CheckboxControl/>
</ListBox>
</Window>