Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added TabControlHelper.IsUnderlined to MetroTabItem #1796

Merged
merged 1 commit into from
Feb 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions MahApps.Metro/Themes/MetroTabItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:MetroTabItem}">
<Border x:Name="Border"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal">
<ContentPresenter x:Name="ContentSite"
Margin="2,1,2,1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Expand Down Expand Up @@ -75,6 +76,13 @@
Visual="{StaticResource tabitem_close}" />
</Button.OpacityMask>
</Button>
</StackPanel>
<Rectangle x:Name="Underline"
Margin="0, 1, 0, 0"
Height="2"
HorizontalAlignment="Stretch"
Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Controls:MetroTabControl}},
Path=(Controls:TabControlHelper.IsUnderlined), Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
Expand All @@ -83,19 +91,28 @@
<Setter Property="TextElement.Foreground"
TargetName="ContentSite"
Value="{DynamicResource AccentColorBrush}" />
<Setter Property="Fill"
TargetName="Underline"
Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger Property="IsSelected"
Value="false">
<Setter Property="TextElement.Foreground"
TargetName="ContentSite"
Value="{DynamicResource GrayNormalBrush}" />
<Setter Property="Fill"
TargetName="Underline"
Value="{DynamicResource GrayNormalBrush}" />
</Trigger>
<Trigger SourceName="ContentSite"
Property="IsMouseOver"
Value="True">
<Setter Property="TextElement.Foreground"
TargetName="ContentSite"
Value="{DynamicResource GrayHoverBrush}" />
<Setter Property="Fill"
TargetName="Underline"
Value="{DynamicResource GrayHoverBrush}" />
<Setter TargetName="PART_CloseButton"
Property="Background"
Value="{DynamicResource GrayHoverBrush}" />
Expand All @@ -107,6 +124,18 @@
Property="Background"
Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" SourceName="ContentSite" Value="True" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="TextElement.Foreground"
TargetName="ContentSite"
Value="{DynamicResource HighlightBrush}" />
<Setter Property="Fill"
TargetName="Underline"
Value="{DynamicResource HighlightBrush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
Expand Down