Hi,
I create a new question instead since the old one was asked so long time ago. original question here: https://ko.infragistics.com/community/forums/f/ultimate-ui-for-wpf/122217/xamtreegrid-live-sorting-with-templatefields
I have a XamTreeGrid with live sorting but when I changed my binding in my template fields to AlternateBindings with a property chain the live sorting stopped to work. I tried with the code where it was working and only changed the binding to AlternateBinding and it worked as long as I specified the "Name" property on the template field. This did not work with a property chain. Is there a way to solve this?
Before change:
<ig:TemplateField Name="MyProperty"DisplayTemplate="{StaticResource MyTemplate}"><ig:TemplateField.Settings><ig:FieldSettingsSortComparer="{StaticResource MySortComparer}" /></ig:TemplateField.Settings></ig:TemplateField>
After change:
<ig:TemplateField Label="My Property" Name="MyClass.MyProperty" BindingType="UseAlternateBinding" AlternateBinding="{Binding Path=MyClass.MyProperty}" DisplayTemplate="{StaticResource MyTemplate}"> <ig:TemplateField.Settings> <ig:FieldSettings SortComparer="{StaticResource MySortComparer}" /> </ig:TemplateField.Settings> </ig:TemplateField>
Hello Hilma,
In the other forum thread we had together, I made the recommendation to use the DataValueChanged event for live sorting, and I believe that event may help you here as well with the maintenance of a live sort.
I am attaching a sample project that demonstrates live sorting with a TemplateField that is alternately bound to a complex object in a XamTreeGrid. I hope it helps.
Please let me know if you have any other questions or concerns on this matter.
XamTreeGridComplexLiveSort.zip
Hi Andrew,
I tried to listen to DataValueChanged in my application and followed the pattern you used in your example, but it still does not work. One difference between your example and my application is that the values in my XamTreeGrid is not updated by the user directly in the grid, but from other parts of the application. Could this cause the problem or do you think I have missed something else?
I have verified on my end that the DataValueChanged event does get hit for properties that are changed outside of the grid.
It is worth noting that it is necessary to opt in to this event to actually get it to fire. Perhaps the issue in this case is a missing FieldSettings.DataValueChangedNotificationsActive = “True” which exists in the sample project I sent you? It also may be helpful to set the DataValueChangedScope to “AllAllocatedRecords” if you are looking to have this event fire for records that are out of view.