【问题标题】:Rebinding a Xceed DataGrid column to accept special characters重新绑定 Xceed DataGrid 列以接受特殊字符
【发布时间】:2015-01-24 01:36:23
【问题描述】:

我正在尝试使用 Xceed WPF DataGrid 来显示 DataTable 对象。 DataTables 恰好有使用特殊字符(例如“/”)的列。这导致 Xceed DataGrid 遇到了与this previous question 中相同的问题。

我试图为所提供的解决方案找到 Xceed 的类比,但我不确定如何使用 Xceed 的 DataGridBindingInfo 类(我相信它管理绑定)来完成我想要的。甚至可以用 Xceed 以这种方式更改绑定吗?

【问题讨论】:

    标签: c# wpf xceed xceed-datagrid


    【解决方案1】:

    在使用断点检查列的状态后,我发现 Xceed 中自动生成的列并没有像我最初想象的那样使用 DataGridBindingInfo 属性。相反,它使用已弃用的 DisplayMemberBinding 属性。我可以通过修改这个属性来解决我的问题,如下所示。

    foreach (var c in grid.Columns)
            {
                var column = c as Xceed.Wpf.DataGrid.Column;
                column.DisplayMemberBinding = new System.Windows.Data.Binding("[" + column.FieldName + "]");
            } 
    

    【讨论】:

      猜你喜欢
      • 2018-07-15
      • 1970-01-01
      • 2022-06-17
      • 1970-01-01
      • 2018-07-15
      • 2021-10-31
      • 1970-01-01
      • 2011-11-24
      • 2016-04-10
      相关资源
      最近更新 更多