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
975
FieldLayoutSettings from StaticResource
posted

I'm not sure if this is possible, but I'm trying to load some FieldLayoutSettings from a resource file.

Basically I've got a resource file for my FieldLayouts, and often for a given grid I'm using two layouts (for top level data and for child data). Both layouts use the same DataRecordCellAreaGridTemplate to define the column widths, so rather than repeating the code for both layouts:

<igDP:FieldLayout
        x:Key="IGFieldLayout_ActionTopLevelItem"
        x:Shared="False"
        Key="LocationTopLevelItem"
        >
        <igDP:FieldLayout.Settings>
            <igDP:FieldLayoutSettings
                LabelLocation="Default"
                >
                <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="100"/>
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
            </igDP:FieldLayoutSettings>
        </igDP:FieldLayout.Settings>

....

I'm hoping that theres a way to define the DataRecordCellAreaGridTemplate, or the FieldLayoutSettings in the resource file so that it can be defined once and referenced by both FieldLayouts?

I've tried something like this:

<igDP:FieldLayoutSettings
        x:Key="IGFieldLayoutSettings_ActionItems"
        >
        <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
            <ItemsPanelTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="100"/>
                    </Grid.ColumnDefinitions>
                </Grid>
            </ItemsPanelTemplate>
        </igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>
    </igDP:FieldLayoutSettings>

But couldn't then reference that StaticResource in my FieldLayouts. I also tried for a straight <igDP:DataRecordCellArea>... resource but couldn't use that either. Is there a way of achieving what I want or do I just have to define the template in each FieldLayout?

Many thanks in advance!

Parents
  • 69686
    Verified Answer
    posted

    Hello,

     DataRecordCellAreaGridTemplate is nothing more than a ItemsPanelTemplate. You can define ItemsPanelTemplate in the resources and by its key set it here <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate>.

    <...Resources> 

                 <ItemsPanelTemplate x:Key="DataRecordCellAreaGridTemplate">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="150"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="100"/>
                        </Grid.ColumnDefinitions>
                    </Grid>
                </ItemsPanelTemplate>

    <...Resources>

    Alex. 

Reply Children
No Data