2

Is there a way to add a checkbox (in addition to text) to a column header in a WPF DataGrid? That is, without using DataGridCheckBoxColumn, which would add checkboxes to all grid cells in that particular column.

Thanks.

1 Answer 1

3

can you try this

<my:DataGrid Margin="72,59,6,3" Name="DataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" >
          <my:DataGrid.Columns>
            <my:DataGridTextColumn Header="Header1">
                <my:DataGridTextColumn.HeaderTemplate>
                    <DataTemplate>
                        <CheckBox Content="{Binding}"/>
                    </DataTemplate> 
                </my:DataGridTextColumn.HeaderTemplate> 
            </my:DataGridTextColumn>
        </my:DataGrid.Columns> 
    </my:DataGrid>
Sign up to request clarification or add additional context in comments.

2 Comments

It was my pleasure to help you..happy 2018
Can you elaborate on how to get the checked state?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.