I have a field in my XamDataGrid "Method". The values in the columnare of type "PaymentMethod". A PaymentMethod object is compromised of an integer PaymentMethodID and a string "PaymentMethodDescription". The field allows the user to select this PaymentMethod via a XamComboEditor from a collection of "ActivePaymentMethods", with DisplayMemberPath set to "PaymentMethodDescription". The filtering DOES work fine, if I filter Check, it shows the two checks etc.
How do i get Grouping to work on this field? I set AllowGroupBy=true, but the grouping doesn't group correctly. If I have a "Check" payment method, a "EFT" payment method, and another "check" payment method and Group By Method, the grid show me "Check", "EFT" and another "Check" group, instead of two groups, Check and EFT, with 2 records in the Check group. Also, the grid doesn't allow me to sort by Method either. How can i fix these issues? I need to group so all of the checks are together, all of the EFTs are together etc.
<igDP:Field Name="PaymentMethod" Label="Method" Width="*" > <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" AllowGroupBy="True" > <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsSource" Value="{Binding Path=DataContext.ActivePaymentMethods, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"/> <Setter Property="DisplayMemberPath" Value="PaymentMethodDescription" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings></igDP:Field>
Hi Travis,
Thanks and glad I could help.
Let me know if you have any questions.
Awesome. You are a genius!
I went over your sample and the issue is not whether you use an ComboBoxItemsProvider. You are creating a collection of PaymentMethods that is bound to your XamConboEditor. So that is what is shown in the control in the Field. The issue you were having was caused by using a class object for the Field so the sorting and grouping were being done against a PaymentMethod object.
I added a BulkPaymentMethodID to your BulkPayment class and changed the field to point to that property instead of your class object. And I added the ValuePath to the XamComboEditorStyle pointing to the PaymentMethodID value in your ActivePaymentMethods collection. The sorting and grouping are now done on the int value instead of the class object they both work as expected.
Take a look at the sample and let me know if you have any questions.
I am not using an ItemsProvider for my XamComboEditor inside the grid. I am binding the ItemsSource to the ViewModel's "ActivePaymentMethods" collection. This is a collection of choices for the Payment Method property of the Payment item being shown in the grid. A payment method has a property "PaymentMethod" that consists of an ID and Name. ActivePaymentMethods is a collection of PaymentMethods as well. So the combo will show all available PaymentMethods, and the user can select one to assign to the Payment's PaymentMethod. As i said, for some reason group by PaymentMethod doesn't work correctly and I can't sort either.
ValueMemberPath is not available for me to set in XAML, i can set ValuePath in the setter of my style, but that doesn't seem to help!
Please see the attached sample project. Run it, and try to group by PayMent Method. You will notice there is a Check group with two items, and ANOTHER check group with one item in it. Also notice clicking to sort by this field does nothing.
Did you see this post?
http://es.infragistics.com/community/forums/p/45162/259559.aspx
It sounds like a similar question, even though it is an older post. Vlad has included a sample where he’s using an Enum collection to value the ComboBoxItemsProvider, defining the DisplayMemberPath and the ValuePath.
While the collection that is the DataSource for the grid contains a numeric property, so the sort and grouping is actually done on that numeric value.
He mentions in his post that it is the value and datatype of the DataSource’s property that controls the sort and grouping.
I’m not seeing a ValueMemberPath or an ItemsProvider reference in your xaml code.
Could you explain how you are defining these?