I'm using WPF and have DataGrid with checkbox column. the problem is that I would like the checkbox to stretch and fill the cell
this is my XAML :
<Grid>
<Controls:DataGrid ItemsSource="{Binding Persons}" AutoGenerateColumns="False">
<Controls:DataGrid.Columns>
<Controls:DataGridTextColumn Binding="{Binding Name}"/>
<Controls:DataGridTemplateColumn>
<Controls:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox />
</DataTemplate>
</Controls:DataGridTemplateColumn.CellTemplate>
</Controls:DataGridTemplateColumn>
</Controls:DataGrid.Columns>
</Controls:DataGrid>
</Grid>
You can put the CheckBox
in a Viewbox
, there will still be a small margin though which probably belongs to some control's Template
, you could either try and change that template or mess with the Margin
if you want to.
<Viewbox Margin="-1">
<CheckBox/>
</Viewbox>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With