Click here to Skip to main content
15,888,031 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 21-Jun-11 1:10am
v2

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900