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
3806
xamgrid self reference data - only 1 header row
posted

hi,

I have self reference data to display in XamGrid and like the example http://www.infragistics.com/samples/wpf/grid/self-referencing-data.

How can remove the redundant header rows and keep just one top header row for whole xamgrid?

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello Gajender,

    You can remove redundant header rows and keep only the top header in the XamGrid by setting the HeaderVisibility property of the ColumnLayout to "Collapsed," but this will require you to structure your XamGrid differently than is shown in the example that you have referenced, as doing this with the structure shown in the example will remove all of the column headers, as the ColumnLayout is shared between all child bands.

    Instead of structuring your XamGrid with a single ColumnLayout that is shared between all parent and child bands, I would recommend that you start by adding to the XamGrid.Columns collection, rather than the XamGrid.ColumnLayouts collection. This will allow you to define a ColumnLayout for each of your child bands, as you can define a structure along the lines of the following:

    <ig:XamGrid.Columns>
       <ig:TextColumn Key="ID"/>
        <ig:TextColumn Key="Label"/>
        <ig:TextColumn Key="Number"/>
        <ig:ColumnLayout Key="Children" HeaderVisibility="Collapsed">
            <ig:ColumnLayout.Columns>
               <ig:TextColumn Key="ID"/>
               <ig:TextColumn Key="Label"/>
               <ig:TextColumn Key="Number"/>
               <ig:ColumnLayout Key="Children" HeaderVisibility="Collapsed">
                   <ig:ColumnLayout.Columns>
                       <ig:TextColumn Key="ID"/>
                        <ig:TextColumn Key="Label"/>
                        <ig:TextColumn Key="Number"/>
                  </ig:ColumnLayout.Columns>
              </ig:ColumnLayout>
           </ig:ColumnLayout.Columns>
        </ig:ColumnLayout>
    </ig:XamGrid.Columns>

    Note, that going this route will require you to define a new ColumnLayout for each of your child bands even though the Columns inside are the same, but this tells the XamGrid to create a new layout for each of the child bands rather than reusing the single one for your particular data type. This essentially allows you to set the HeaderVisibility property on a hierarchical basis, as shown.

    I have attached a sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    GridSLTest.zip
Children
No Data