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
755
Is there a way to specify the layout to use in a master/detail grid?
posted

Hi,

I have a master/detail grid that uses 3 diferent layouts.  The number of details completely dynamic.  Sometimes, the grid does'nt take the good layout.

A FieldLayout defines the Fields (columns) contained in a particular DataRecord. When a DataRecord is created, the FieldLayouts collection is searched for an existing FieldLayout whose Fields match the DataItem's properties.

I would like to spécify the layout to use in the detail, in the definition of the field in the master layout.

That would look like :

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hi,

I have a master/detail grid that uses 3 different layouts. 
Here is an example...

<dg:DataGrid.FieldLayouts>
    <igDP:FieldLayout>
      <igDP:FieldLayout.Fields>
        <igDP:Field Name="AccountNumber"/>
        <igDP:Field Name="Name"/>
      </igDP:FieldLayout.Fields>
    </igDP:FieldLayout>

    <igDP:FieldLayout>
      <igDP:FieldLayout.Fields>
        <igDP:Field Name="ClientNumber"/>
        <igDP:Field Name="Name"/>
        <igDP:Field Name="Accounts"/>
      </igDP:FieldLayout.Fields>
    </igDP:FieldLayout>

    <!--Relations-->
    <igDP:FieldLayout>
      <igDP:FieldLayout.Fields>
        <igDP:Field Name="LinkNumber"/>
        <igDP:Field Name="FullName"/>
        <igDP:Field Name="Accounts"/>
        <igDP:Field Name="Clients"/>
      </igDP:FieldLayout.Fields>

    </igDP:FieldLayout>

  </dg:DataGrid.FieldLayouts>
 
  The layout used for the master is not always the same and the number of details is dynamic.
 
  I would like to specify, in the xaml or programaticaly, the layout to use in the definition of the field
 
  ex :
 
        <igDP:Field Name="Accounts" Layout="NameOfTheLayoutToUseInTheDetail"/>
       
 Is there a way to acheive this?
 Thanks
 Karine
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<

 

dg:XamDataGrid.FieldLayouts>

 

 

 

 

 

 

<

 

 

igDP:FieldLayout

>

<

 

 

igDP:FieldLayout.Fields

>

<

 

 

dg:DataGridField

>

<

 

 

igDP:Field Name="AccountNumber"/

>

<

 

 

igDP:Field Name="Name"

>

</

 

 

igDP:FieldLayout.Fields

>

</

 

 

igDP:FieldLayout

>

<!--

 

 

Client

-->

<

 

 

igDP:FieldLayout

>

<

 

 

igDP:FieldLayout.Settings

>

<

 

 

igDP:FieldLayoutSettings AutoGenerateFields="False" LabelLocation="Hidden"

/>

</

 

 

igDP:FieldLayout.Settings

>

<

 

 

igDP:FieldLayout.Fields

>

<

 

 

dg:DataGridField

>

<

 

 

dg:DataGridField.Settings

>

<

 

 

igDP:FieldSettings CellWidth="16" LabelWidth="16" AllowGroupBy="False" AllowResize="False" CellValuePresenterStyle="{StaticResource elementTypeIconStyle}"

/>

</

 

 

dg:DataGridField.Settings

>

</

 

 

dg:DataGridField

>

<

 

 

igDP:Field Name="ClientNumber"

>

<

 

 

igDP:Field.Settings

>

<

 

 

igDP:FieldSettings CellWidth="70" LabelWidth="70"

/>

</

 

 

igDP:Field.Settings

>

</

 

 

igDP:Field

>

<

 

 

igDP:Field Name="Name"

>

<

 

 

igDP:Field.Settings

>

<

 

 

igDP:FieldSettings CellWidth="150" LabelWidth="150"

/>

</

 

 

igDP:Field.Settings

>

</

 

 

igDP:Field

>

<

 

 

igDP:Field Name="Accounts"

/>

</

 

 

igDP:FieldLayout.Fields

>

</

 

 

igDP:FieldLayout

>

 

<!--

 

 

Relations

-->

<

 

 

igDP:FieldLayout

>

<

 

 

igDP:FieldLayout.Settings

>

<

 

 

igDP:FieldLayoutSettings AutoGenerateFields="False" LabelLocation="Hidden"

/>

</

 

 

igDP:FieldLayout.Settings

>

<

 

 

igDP:FieldLayout.Fields

>

<

 

 

dg:DataGridField

>

<

 

 

dg:DataGridField.Settings

>

<

 

 

igDP:FieldSettings CellWidth="16" LabelWidth="16" AllowGroupBy="False" AllowResize="False" CellValuePresenterStyle="{StaticResource elementTypeIconStyle}"

/>

</

 

 

dg:DataGridField.Settings

>

</

 

 

dg:DataGridField

>

<

 

 

igDP:Field Name="LinkNumber"

>

<

 

 

igDP:Field.Settings

>

<

 

 

igDP:FieldSettings CellWidth="70" LabelWidth="70"

/>

</

 

 

igDP:Field.Settings

>

</

 

 

igDP:Field

>

<

 

 

igDP:Field Name="FullName"

>

<

 

 

igDP:Field.Settings

>

<

 

 

igDP:FieldSettings CellWidth="150" LabelWidth="150"

/>

</

 

 

igDP:Field.Settings

>

</

 

 

igDP:Field

>

<

 

 

igDP:Field Name="Accounts"

/>

</

 

 

igDP:FieldLayout.Fields

>

</

 

 

igDP:FieldLayout

>

</

 

 

dg:DataGrid.FieldLayouts

>

 

 

 

Parents
  • 2426
    Suggested Answer
    posted

    Hello Karine,

    As far as I know, the FieldLayout cannot be set on the Field object. Your best  approach may be to programmatically set your FieldLayouts in code. Here is a high level example of the options you have available from the code-behind:

                grid.FieldLayouts.Clear();
                FieldLayout fl = new FieldLayout();
                Field field = new Field();
                fl.Fields.Add(field);
                fl.Fields.Remove(fl.Fields[0]);

    Hope that helps.

Reply Children
No Data