WPF 工具包 DataGridColumnHeader 在数据重新加载后不维护样式

发布于 2024-10-01 16:28:51 字数 292 浏览 0 评论 0原文

我正在使用 DataGrid 工具包。当用户对任何列进行排序时,有一个自定义标题样式。但是数据每隔几秒刷新一次,并且从服务器检索新的数据表(我根据原始排序对数据表中的数据进行排序)。但因此,标头返回到默认外观。 我尝试在列上显式分配 sortDirection,例如...

theGrid.ColumnFromDisplayIndex(i).SortDirection = ListSortDirection.Ascending;

这也不能解决问题。

有人知道这个问题有什么解决办法吗?

I am using Toolkit DataGrid. There is a custom header style when user sorts any column. But the data is refreshed after every few seconds and the new datatable is retrived from the server(I made the data in datatable sort based on the original sort).But because of this the header goes back to the default look.
I have tried explicitly assigning the sortDirection on the column like...

theGrid.ColumnFromDisplayIndex(i).SortDirection = ListSortDirection.Ascending;

This doesn't solve the issue either.

Anybody knows any solution for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉栀 2024-10-08 16:28:51

更新 DataGrid 项目源之后,您必须在 DataGridColumn 上指定 SortDirection 属性,以便它可以获得样式。

You must specify the SortDirection property on the DataGridColumn after updating the DataGrid itemssource so it can get the style.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文