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
195
Odd problem with inheriting styles
posted

I have a global textblock style set at the app level so all textblocks will inherit the style (unless overridden).

 I also have a style for the xamDataGrid header row for background etc. When I set the foreground, font size, etc it is not taking but is taking the app level textblock style. How can I stop infragistics wpf controls from doing this? Having same issue now with xamMaskedEditor.

 Hope that makes since.

 

<StackPanel>
        <StackPanel.Resources>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize"
                        Value="22" />
                <Setter Property="Foreground"
                        Value="Red" />
            </Style>
        </StackPanel.Resources>

        <igEditors:XamMaskedEditor Text="37128"
                                   Mask="nnnnn">
            <igEditors:XamMaskedEditor.Style>
                <Style TargetType="{x:Type igEditors:XamMaskedEditor}">
                    <Setter Property="Foreground"
                            Value="Blue" />
                </Style>
            </igEditors:XamMaskedEditor.Style>
        </igEditors:XamMaskedEditor>
        <TextBlock Text="This is a test" />
        <TextBlock Text="This is a test overiding inherited style">
            <TextBlock.Style>
                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="Foreground"
                            Value="Blue" />
                </Style>
            </TextBlock.Style>
        </TextBlock>

    </StackPanel>

Parents
  • 69686
    posted

     Hello,

    To change the style of the header area you have to create a style and set the TargetType property to  {x:Type igDP:LabelPresenter} and modify it like you wish. In this case you can see the default style of the LabelPresenter in the local directory "~\Infragistics\NetAdvantage for WPF 2008 Vol. 2\DefaultStyles" and all the wpf controls too. In the future it would be easier to create styles for the particular area and not worry about which style overrides the other.

    Hope this helps. 

Reply Children