Datagrid SortMemberPath =绑定给出错误未设置对象引用 [英] Datagrid SortMemberPath=Binding gives error Object reference not set

查看:247
本文介绍了Datagrid SortMemberPath =绑定给出错误未设置对象引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

在我的datagrid中,我的textColumn看起来像:
崩溃

< datagridtextcolumn标头=名称">
IsReadOnly ="True" Width ="300"
Binding ="{Binding Path = CT_APPR.NAME}"
SortMemberPath ="{Binding Path = CT_APPR.NAME}">


我的datagrid看起来不错,因此绑定是正确的.
但是,当我单击列标题对列进行排序时,出现错误:
对象引用未设置为对象的实例."
当列中显示正确的名称时怎么办?

还有另一种方法可以解决排序问题吗?按单元格值排序?

谢谢

Hello ,

In my datagrid my textColumn looks like:
Collapse

<datagridtextcolumn header="Name">
IsReadOnly="True" Width="300"
Binding="{Binding Path=CT_APPR.NAME}"
SortMemberPath="{Binding Path=CT_APPR.NAME}" >


My datagrid looks fine, so the binding is correct.
But when I click on the column-header to sort the column I get the error:
"Object reference not set to an instance of an object."
How can that be, when the correct name is shown in the column?

Is there another way to get the sorting fixed? Sort on the cell-value?

Thank you

推荐答案

我认为这对您有帮助
http://stackoverflow.com/questions/1296532/制作一个datagrid-column-header-sortable-in-wpf-using-c [
I think this will help you
http://stackoverflow.com/questions/1296532/making-a-datagrid-column-header-sortable-in-wpf-using-c[^]

Or else try to put it into the SortMemberPath header template


这篇关于Datagrid SortMemberPath =绑定给出错误未设置对象引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆