views:

670

answers:

3

Continuing my problem from yesterday, the Silverlight datagrid I have from this issue is now causing Stack Overflow errors when sorting a column with a large amount of data (Like the text column that contains a where clause for a SQL statment). When you sort, it'll fire the SelectedIndexChanged event for the datagrid and then still try to stort. If you click the header again the stack overflow occours.

Does anyone have an idea on how to stop the sorting on this control for a column? All the other columns sort fine (but still fire that darn SelectedIndexChanged event), but if I could shut off the column for whereClause it'd be perfect.

Does anyone have a better idea at how to get this to work?

A: 

Give this a shot:

dataGridView1.Columns[*Numberofthecolumnyoudontwantsorted*].SortMode
= DataGridViewColumnSortMode.NotSortable;
BKimmel
A: 

@BKimmel - It won't work since this is in silverlight and apparently that part of the grid column has not yet been worked on. In the XAML of the page it doesn't show up with the attribute for sortmode on the columns, and in the backend code, it doesn't recognize it as it isn't a web control, it's a silverlight control.

Thanks though. Anyone else?

Rob
+2  A: 

I'm only familiar with the WPF version of this datagrid, but try this:

<data:DataGridTextColumn CanUserSort="False" Header="First Name" Binding="{Binding FirstName}" />

Add the CanUserSort="False" attribute on each column you don't want sorted.

Bob King