I am setting IsSorting property for unbound column in xaml. When accessing the property in code behind its always false even if I set the IsSortable property to true in xaml
Here what I am doing. In Xaml
<Grids:UnboundColumn Key="FirstName" HeaderText="First Name" Width="200" IsSortable="True" IsFilterable="true" IsReadOnly="False"> <Grids:UnboundColumn.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding RowData.FirstName}" /> </DataTemplate> </Grids:UnboundColumn.ItemTemplate>
</Grids:UnboundColumn>
In code behind :
foreach (var col in this.FilterGrid.Columns){ if (col.GetType() == typeof(UnboundColumn)) { var column = col as UnboundColumn; bool test= column.IsSortable }}
IsSortable property returns always false.Whereas other properties like IsFilterable,IsReadOnly etc works fine.
I will appreciate if any one has a fix for this
Hi,
Unless the data's bound, the only way you'll be able to sort with an UnboundColumn is by supplying a ValueConverter.
-SteveZ
actually I was trying to change the code in the grid..I have wrapper for Infragistics grid.
I wanted to check there that if its Unbound column than apply sort compare only If IsSortable property for that column is true.
Is it possible??
Check out the following Help article: http://help.infragistics.com/NetAdvantage/Silverlight/2011/1/CLR4.0/?page=xamGrid_Sorting_Unbound_Columns.html
Basically, the only way we can possibly know what to sort by, is if you give us a ValueConverter.
Note: while we try to do this as efficiently as possible, if it's possible to add a Bound calculated property to your underlying data object, you'll get much better performance, as we won't have to convert every object in every row in order to retrieve the values to sort by.
Actually its a UnBoundColumn. For testing purpose I have Included FirstName Property in the dto.
Can you please let me know whether there is a bug for IsSortable for unbound column?
I will appreciate your quick response
hi,
Given that "FirstName" is a property of your data object, why don't you use TemplateColumn. All features will work out-of-the-box with TemplateColumn.
UnboundColumn, as the name states, is for unbound data - for example calculated values based on the fields of the data object. You can read more about UnboundColumn here.
Regards