wpf datagridcheckboxcolumn style

wpf, wpfdatagrid, xaml

Solution

You can use DataGridTemplateColumn to create a custom checkboxcolumn

                                <Custom:DataGridTemplateColumn x:Name="gdchk" Header="Test" MaxWidth="50">
                                <Custom:DataGridTemplateColumn.CellTemplate >
                                    <DataTemplate>
                                        <CheckBox IsChecked="{Binding Path = classname}" HorizontalAlignment="Center" Style="{DynamicResource myCheckBoxStyle}"/>
                                    </DataTemplate>
                                </Custom:DataGridTemplateColumn.CellTemplate>
                            </Custom:DataGridTemplateColumn>

Hope this helps.

Problem

Imagine I have a CheckBox custom style named "MyCheckBoxStyle". How can I make a Datagrid style that embeds a custom DataGridCheckBoxColumn style based on my MyCheckBoxStyle?

Original source