Soni Ali
2009-05-04 13:06:15
A:
Because none of these themes come merely close to my requirements. Thanks for the link anyway.
Mac
2009-05-04 13:15:08
A:
May I ask why custom colors are required on all controls in your application? Personally, I don't like it very much when an application does not use the look and feel of my desktop environment.
Of course, there are sometimes situations, where it might make sense to do some custom styling, but I would say these cases are rare and do not generally apply to the whole application.
Simon Lehmann
2009-05-04 13:06:23
+2
A:
Your best bet, to ensure a consistent behavior and appearance across operating systems, would be to re-template the TabItem control and then use a Trigger to modify a part of your new template when a TabItem is selected. Try something like the following:
<Grid>
<Grid.Resources>
<Style x:Key="Custom">
<Setter Property="Control.Background" Value="#FF47C7C8"/>
<Setter Property="Control.BorderBrush" Value="#FF47C7C8"/>
<Setter Property="Control.Foreground" Value="White"/>
</Style>
<Style BasedOn="{StaticResource Custom}" TargetType="TabControl"/>
<Style TargetType="TabItem">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid>
<Border
Name="Border"
Background="#FF47C7C8"
BorderBrush="#FFFFFF"
BorderThickness="1,1,1,1"
CornerRadius="2,2,0,0">
<ContentPresenter
x:Name="ContentSite"
HorizontalAlignment="Center"
Margin="12,2,12,2"
VerticalAlignment="Center"
ContentSource="Header"
RecognizesAccessKey="True"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Panel.ZIndex" Value="100"/>
<Setter TargetName="Border" Property="Background" Value="#FF47C7C8"/>
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<TabControl>
<TabItem Header="Item 1"/>
<TabItem Header="Item 2"/>
<TabItem Header="Item 3"/>
<TabItem Header="Item 4"/>
</TabControl>
Bon chance!
Peter
2009-05-13 14:26:40
You must have gotten it frome http://msdn.microsoft.com/en-us/library/ms752032.aspx. Merci en tous cas !
Mac
2009-05-13 16:06:36
Actually, I just tweaked one of the "Simple Styles" (http://blog.nerdplusart.com/simplestyles) snippets in Kaxaml. They're a great starting point when you need to customize the appearance of your WPF controls. :)
Peter
2009-05-13 16:36:41