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
35
Multiple Setter.Value for a single Setter Property
posted

Hi,

I am trying to create a style for a custom control which inherits XamDataGrid. There are no actual alterations between my custom control  and XamDataGrid.

The following code is placed inside Themes/generic.xaml:

<Style x:Key="{x:Type local:MyXDG}" BasedOn="{StaticResource {x:Type igDP:XamDataGrid}}" TargetType="{x:Type local:MyXDG}" >       

        <Setter Property="ScrollingMode" Value="DeferredWithScrollTips"/>

        <Setter Property="Theme" Value="Office2k7Black"/>

        <Setter Property="Margin" Value="0,56,0,0"/>

<!-- The Above 3 Properties work -->

        <Setter Property="FieldLayoutSettings">

            <Setter.Value>

                <igDP:FieldLayoutSettings HighlightAlternateRecords="True"/>

        </Setter.Value>

        </Setter>

        <Setter Property="FieldLayoutSettings">

            <Setter.Value>

                <igDP:FieldLayoutSettings AllowDelete="False"/>

            </Setter.Value>

        </Setter>       

    </Style>

 

The issue I am having is to do with the two separate <Setter Property="FieldLayoutSettings"> tags. The lower tag always seems to be the only change made of the two.

In the above example the AllowDelete works but not the HighlightAlternateRecords. If I was to place the HighlightAlternateRecords beneath the AllowDelete than the HighlightAlternateRecords would work but not the AllowDelete.

What I was wondering is if there was a way to declare Nested Setter Properties (like FieldLayoutSettings.Whatever) so they do not overwrite each other.

 

Thanks

Parents
No Data
Reply
  • 35
    posted

    I was able to just append the extra FieldLayoutSettings

     

    <Style TargetType="{x:Type igDP:XamDataGrid}">

                    <Setter Property="FieldLayoutSettings">

                        <Setter.Value>

                            <igDP:FieldLayoutSettings AllowFieldMoving="No" HighlightAlternateRecords="True" />

                        </Setter.Value>

                    </Setter>

                </Style>

Children
No Data