![]() |
CodePlex Tabs |
![]() |
Azure Tabs |
The main difference apart from the inclusion of the icons on the Azure tabs is the mouse over style. On CodePlex when you mouse over a tab it colours in the bottom border. On Azure the coloured border is always there, and hovering the mouse fills the tab in blue.
I have gone for the mouse over style from Azure with the tabs from CodePlex. I have also made a replica of the navigation tabs at the top of the Azure page.
WPF Style |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Style x:Key="AzureTabItem" TargetType="{x:Type TabItem}"> | |
<Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}"/> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="TabItem"> | |
<StackPanel> | |
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" | |
Padding="12,2,24,2" | |
BorderThickness="0,0,0,4" | |
Margin="2,2,2,0" | |
SnapsToDevicePixels="True"> | |
<Border.Style> | |
<Style TargetType="Border"> | |
<Setter Property="Background"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource Gray5}"/> | |
</Setter.Value> | |
</Setter> | |
</Style> | |
</Border.Style> | |
<Label x:Name="root" FontSize="15"> | |
<Label.Style> | |
<Style TargetType="Label"> | |
<Setter Property="Foreground"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource BlackColor}" /> | |
</Setter.Value> | |
</Setter> | |
</Style> | |
</Label.Style> | |
<ContentPresenter ContentSource="Header" RecognizesAccessKey="True" /> | |
</Label> | |
</Border> | |
<Canvas Height="10" Width="20" x:Name="arrow" Margin="25,0,0,0" | |
HorizontalAlignment="Left" SnapsToDevicePixels="True"> | |
<Path Data="M 0 0 H 20 L 10 10 Z" | |
StrokeThickness="0" | |
Fill="{DynamicResource AccentColorBrush}"/> | |
</Canvas> | |
</StackPanel> | |
<ControlTemplate.Triggers> | |
<Trigger Property="IsSelected" Value="true"> | |
<Setter TargetName="root" Property="Foreground"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource WhiteColor}" /> | |
</Setter.Value> | |
</Setter> | |
<Setter TargetName="border" Property="Background"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource AccentColor}"/> | |
</Setter.Value> | |
</Setter> | |
<Setter TargetName="border" Property="BorderBrush"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource AccentColor}"/> | |
</Setter.Value> | |
</Setter> | |
<Setter TargetName="arrow" Property="Visibility" Value="Visible"/> | |
</Trigger> | |
<Trigger Property="IsSelected" Value="false"> | |
<Setter TargetName="root" Property="Foreground"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource BlackColor}" /> | |
</Setter.Value> | |
</Setter> | |
<Setter TargetName="arrow" Property="Visibility" Value="Hidden"/> | |
</Trigger> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Setter TargetName="root" Property="Foreground"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource WhiteColor}" /> | |
</Setter.Value> | |
</Setter> | |
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource AccentColorBrush}"></Setter> | |
<Setter TargetName="border" Property="Background"> | |
<Setter.Value> | |
<SolidColorBrush Color="{DynamicResource AccentColor}"/> | |
</Setter.Value> | |
</Setter> | |
</Trigger> | |
</ControlTemplate.Triggers> | |
</ControlTemplate> | |
</Setter.Value> | |
</Setter> | |
</Style> |
An example of using the styles:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="*"/> | |
</Grid.RowDefinitions> | |
<TabControl Grid.Row="0" Padding="0"> | |
<TabControl.Resources> | |
<Style TargetType="TabItem" BasedOn="{StaticResource AzureTabItem}"/> | |
</TabControl.Resources> | |
<TabItem Header="HOME"> | |
<TabControl> | |
<TabControl.Resources> | |
<Style TargetType="TabItem" BasedOn="{StaticResource AzureNavTabItem}"/> | |
</TabControl.Resources> | |
<TabItem Header="PAGE INFO"></TabItem> | |
<TabItem Header="CHANGE HISTORY"></TabItem> | |
</TabControl> | |
</TabItem> | |
<TabItem Header="SOURCE CODE" BorderBrush="Red"> | |
<TabControl> | |
<TabControl.Resources> | |
<Style TargetType="TabItem" BasedOn="{StaticResource AzureNavTabItem}"/> | |
</TabControl.Resources> | |
<TabItem Header="FILES"></TabItem> | |
<TabItem Header="HISTORY"></TabItem> | |
<TabItem Header="FORKS"></TabItem> | |
</TabControl> | |
</TabItem> | |
<TabItem Header="DOCUMENTATION" BorderBrush="LightGreen"> | |
<TabControl> | |
<TabControl.Resources> | |
<Style TargetType="TabItem" BasedOn="{StaticResource AzureNavTabItem}"/> | |
</TabControl.Resources> | |
<TabItem Header="ITEM 1"></TabItem> | |
<TabItem Header="ITEM 2"></TabItem> | |
</TabControl> | |
</TabItem> | |
</TabControl> | |
</Grid> |
Hi, I tried your styling but in my application, the text foreground appears to be white and doesn't display. Could you post your entire application? Thank you very mcuh
ReplyDeleteHi, I've uploaded a demo here.
ReplyDeleteHope this helps.
The following link has something cool you may like
ReplyDeletehttp://goldcing.blogspot.com/2013/12/making-wpf-application-contain-both.html
That's really awesome! Thank you very much....
ReplyDeleteYou should submit to MahApps.Metro (if you haven't already). Great looking tabs!
ReplyDeleteThank you very much,,,,
ReplyDeleteThank you very much,,,,
ReplyDeleteAwesome... I am new to WPF and metro.. I was looking for this all day and now I just find it. You should submit this to mahapps.metro like other person said..
ReplyDeleteAnd for the record your work works in first try :)
Thank you!!!! Great job!!!!
ReplyDeleteHi there! Great work, which license is it on? Can it be used in not open source project? Thank you!
ReplyDeleteHey. I've not put a license on it but go ahead and use it for whatever you want, open or closed source. Thanks for your interest :)
DeleteThank you so much <3
Delete