开发者

Click on a datagrid column header impossible

开发者 https://www.devze.com 2023-04-12 09:55 出处:网络
I created a datagrid with dataGridTemplateColumn and I can\'t use the click on header to sort anymore. Here is a sample of my code :

I created a datagrid with dataGridTemplateColumn and I can't use the click on header to sort anymore. Here is a sample of my code :

       <DataGrid.Columns>
            <DataGridTemplateColumn Header="action id" Width="Auto">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>开发者_JAVA百科
                        <Label Content="{Binding id}" />
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>

Do you have an idea of what is going wrong? Is this because of the use of a template that the default sort is desactivated?

Thanks,

J.


you should set the SortMemberPath property

<DataGridTemplateColumn SortMemberPath="id" Header="action id" Width="Auto">


Try setting the property CanUserSortColumn = true for your DataGridTemplateColumn.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号