Skip to content

Instantly share code, notes, and snippets.

@DamianSuess
Created October 5, 2021 18:03
Show Gist options
  • Save DamianSuess/0bdf56a73149c4317dc92ace088a2f39 to your computer and use it in GitHub Desktop.
Save DamianSuess/0bdf56a73149c4317dc92ace088a2f39 to your computer and use it in GitHub Desktop.
XAML Grid's first column styles for CheckBoxes
<Page.Resources>
<Style TargetType="{x:Type CheckBox}"
BasedOn="{StaticResource {x:Type CheckBox}}">
<Style.Triggers>
<Trigger Property="Grid.Column" Value="0">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
<Grid Margin="0 30 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="300" />
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Row="0" Grid.Column="0" IsHitTestVisible="False" />
<CheckBox Grid.Row="1" Grid.Column="0" IsHitTestVisible="False" />
<CheckBox Grid.Row="2" Grid.Column="0" IsHitTestVisible="False" />
</Grid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment