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
390
How to change the background color behind tab items
posted

I have the display of my tabs just about right, the last thing I need to change is the the color of the background behind the tab headers.  I've tried lookiing through the xamTabControl properties and looking through feature browser, but can't seem to isolate how to change the color for that area.  It seems like it should be a simple property on the xamTabControl.

Parents
  • 54937
    Suggested Answer
    Offline posted

    Most controls in WPF expose only a few basic look related properties (e.g. Background, BorderBrush, BorderThickness). For things outside of this you normally need to retemplate the element. For our controls we try to expose ResourceKeys for brushes we use where possible. In this case some of the themes (e.g. Office2k7(Blue|Black|Silver)) do use a resourcekey for that area so depending on what theme you are using you may just be able to put a SolidColorBrush into the tabcontrol's Resources with a key of "{x:Static igWindows:PrimitivesBrushKeys.TabControlTabStripCenterFillKey}". For other themes you would need to retemplate the control and set a background on the PART_HeaderArea. One other option is to set the ItemsPanel and set the Background of that element. This would control the area containin the tab items but not the area containing the pre/post tabitemcontent  e.g. 

    <igWindows:XamTabControl.ItemsPanel>
        <ItemsPanelTemplate>
            <igWindows:TabItemPanel 
                Background="Green" 
                InterTabSpacing="{Binding Path=InterTabSpacing, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                TabLayoutStyle="{Binding Path=TabLayoutStyle, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                MaximumSizeToFitAdjustment="{Binding Path=MaximumSizeToFitAdjustment, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                MinimumTabExtent="{Binding Path=MinimumTabExtent, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                TabStripPlacement="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                InterRowSpacing="{Binding Path=InterRowSpacing, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                MaximumTabRows="{Binding Path=MaximumTabRows, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}"
                />
        </ItemsPanelTemplate>
    </igWindows:XamTabControl.ItemsPanel>
Reply Children