Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It appears to be a subtle bug in the control template for the GroupBox. I found by editing the default template for the GroupBox and moving the Border named 'Header' to the last item in the control templates Grid element, the issue resolves itself. </p> <p>The reason is that the one of the other Border elements with a TemplateBinding of BorderBrush was further down in the visual tree and was capturing the mouse click, that's why setting the BorderBrush to null allowed the CheckBox to correctly receive the mouse click.</p> <p>Below is resulting style for the GroupBox. It is nearly identical to the default template for the control, except for the Border element named 'Header', which is now the last child of the Grid, rather than the second.</p> <pre><code>&lt;BorderGapMaskConverter x:Key="BorderGapMaskConverter"/&gt; &lt;Style x:Key="GroupBoxStyle1" TargetType="{x:Type GroupBox}"&gt; &lt;Setter Property="BorderBrush" Value="#D5DFE5"/&gt; &lt;Setter Property="BorderThickness" Value="1"/&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type GroupBox}"&gt; &lt;Grid SnapsToDevicePixels="true"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;RowDefinition Height="*"/&gt; &lt;RowDefinition Height="6"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="6"/&gt; &lt;ColumnDefinition Width="Auto"/&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;ColumnDefinition Width="6"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Border Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4"/&gt; &lt;ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2"/&gt; &lt;Border Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4"&gt; &lt;Border.OpacityMask&gt; &lt;MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7"&gt; &lt;Binding Path="ActualWidth" ElementName="Header"/&gt; &lt;Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/&gt; &lt;Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/&gt; &lt;/MultiBinding&gt; &lt;/Border.OpacityMask&gt; &lt;Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3"&gt; &lt;Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/&gt; &lt;/Border&gt; &lt;/Border&gt; &lt;Border x:Name="Header" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Padding="3,1,3,0"&gt; &lt;ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True"/&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload