添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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 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
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •