I have a xamDataGRid for which I have created two FieldLayout definitions. The Class which gets bound to the grid have some properties and a collection of objects of a different class. The collection is a list which shows up as a child row in the grid.
All that workd fine. My problem is that grouping the fields using the standard xamDataGrid header does not work, instead of grouping the records it sorts them. Is there something I need to do to make the grouping work in a master/child record layout ?
Below is the XAML and codebehind for a sample app which reroduces the error.
<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ig="http://infragistics.com/Windows" xmlns:igDP="http://infragistics.com/DataPresenter" Title="Window1" Height="300" Width="619"> <Grid> <igDP:XamDataGrid x:Name="xdgTest"> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout Key="PersonalInfo"> <igDP:FieldLayout.Fields> <igDP:Field Name="Name" Label="Name"/> <igDP:Field Name="Age" Label="Age"/> <igDP:Field Name="Address" Label="Name"/> <igDP:Field Name="Contacts" Label="Contacts"/> </igDP:FieldLayout.Fields> </igDP:FieldLayout>
<igDP:FieldLayout Key="ContactInfo"> <igDP:FieldLayout.Fields> <igDP:Field Label="Contact Type" Name="Type"/> <igDP:Field Label="Contact" Name="Value"/> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid> </Grid></Window>
namespace WpfApplication1{ public class Contact { public string Type { get; set; } public string Value { get; set; } }
public class Person { public Person(string Nm, int Ag, string Addr, List<Contact> Phones) { Name = Nm; Age = Ag; Address = Addr; Telephones = Phones; } public string Name { get; set; } public int Age { get; set; } public string Address { get; set; } public List<Contact> Telephones { get; set; } }
public partial class Window1 : Window { List<Person> Fields = new List<Person>();
public Window1() { InitializeComponent();
List<Contact> Contacts = new List<Contact>(); Contacts.Add(new Contact{Value = "5561-6195", Type = "Home"}); Contacts.Add(new Contact { Value = "3048-6331", Type = "Home" }); Contacts.Add(new Contact { Value = "9233-9116", Type = "Mobile" });
Fields.Add(new Person("Thomaz", 38, "Constantino de Sousa 172", Contacts));
xdgTest.DataSource = Fields; } }}
Thanks Aaron
I was hoping there would be a way to group by the child layout but I guess I'll need to rethink my strategy.
Regards
Tom
Hello kobethom,
The XamDataGrid supports grouping by the root FieldLayout only. You can view the documentation regarding that here.
I am not really sure why the UI is exposing the child FieldLayout in the group by area. I am going to log this with development and follow up with you via a support case.