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
925
Assigning FieldSettings' properties from ResourceDictionary
posted

Hello and happy new year from Italy :)

I defined a common style for all the grid controls (XamDataGrid) that are used in my application.
I would like to add this style a new "feature": all columns headers must be centered.

This is actually accomplished by setting this property on each grid's definition:

    <igDP:XamDataGrid .. >
        <igDP:XamDataGrid.FieldSettings>
            <igDP:FieldSettings LabelTextAlignment="Center" />
        </igDP:XamDataGrid.FieldSettings>
    </igDP:XamDataGrid>

What I would like to do now is assigning this property directly from the common style, in this way:

   <Style TargetType="{x:Type igDP:XamDataGrid}">
      <Setter Property="FieldSettings">
         <Setter.Value>
            <igDP:FieldSettings LabelTextAlignment="Center" />
         </Setter.Value>
      </Setter>
   </Style>

Unfortunately this doesn't work, as Alex pointed out some years ago in this thread:
http://es.infragistics.com/community/forums/t/33158.aspx

Is there a better solution or a workaround, to avoid setting the property individually on each grid, throughout the application?
Thanks, bye. Maria