Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Header SubGroup Level
posted

Hi,

I would like to have a header that include some columns and I want it to react properly when columns move.  I tried many different options and I never succeed to make it work correctly.  The best I found is to add a column with no data in the row zero and add the "children" columns on the row one.

Example:

 

Based on the example, I want to add the group "Persons" but I just want it to be an identifier that groups the columns Firstname and Lastname.  If I move Persons (in a larger table), the columns Firstname et Lastname would move with it.  Inside Persons, I want to still be able to change the column Firstname and Latname positions.

Do you know if the XamDataGrid support this kind of grouping and if yes, how can I use it.

Parents
  • 69686
    posted

    Hello,

    Currently, the XamDataGrid does not support this out of the box. What you could do is handle the FieldPositionChanging event( which will fire before the field changes position) and save its position. Then you can handle the FieldPositionChanged (which fires after the position has changed) and move the rest of the fields which are dependant of the currently moving one. You can do that by setting a new ActualPosition for them, Something like:

    if (e.Field.Name == "Persons")

                    {

                        e.Field.Owner.Fields["PersonFirstName"].ActualPosition = new FieldPosition(fp.Column, fp.Row + 1, 1, 1);

                        e.Field.Owner.Fields["PersonLastName"].ActualPosition = new FieldPosition(fp.Column + 1, fp.Row + 1, 1, 1);

                    }

    where fp is the Persons Field's ActualPosition.

Reply Children