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
495
Managing the column width in hierarchical datagrid
posted

Hello,

I have a hierarchical data grid, bound to a collection, which has a list as one of it's member.

I set the DataRecordCellAreaGridTemplate property for the normal data rows, but I can find a way to apply it separately to the hierarchical row, which presents the list member.

This is an example of a code like mine:

<igDP:XamDataGrid Name="SampleDataGrid"
                         GroupByAreaLocation="None"
                         AutoFit="True">
            <igDP:XamDataGrid.FieldLayoutSettings>
                <igDP:FieldLayoutSettings AutoGenerateFields="False" >
                    <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
                        <ItemsPanelTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                            </Grid>
                        </ItemsPanelTemplate>
                </igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
              </igDP:FieldLayoutSettings>
            </igDP:XamDataGrid.FieldLayoutSettings>
            <igDP:XamDataGrid.FieldLayouts>
                <igDP:FieldLayout>
                    <igDP:Field Name="OfficeName" Label="OfficeName" />
                    <igDP:Field Name="OfficeAdress" Label="OfficeAdress" />
                    <igDP:Field Name="List" Label="List" />
                </igDP:FieldLayout>
                <igDP:FieldLayout>
                    <igDP:Field Name="Id" Label="Id" />
                    <igDP:Field Name="Name" Label="Name" />
                </igDP:FieldLayout>
            </igDP:XamDataGrid.FieldLayouts>
        </igDP:XamDataGrid>

Thanks in advace.

  • 69686
    posted

    Hello,

    As you are using XamDataGrid.FieldLayoutSettings, they will be applied to all of the fieldlayouts.

    You can however specify this per FieldLayout by setting its Settings , i.e. FieldLayout.Settings.

    Please note that fields also expose LabelWidht / CellWidth,etc. properties