Skip to content

Fix Enhance Mouseover Visuals for TabControl #3803

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion src/MaterialDesignThemes.Wpf/TabAssist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void SetHeaderPanelMargin(DependencyObject element, Thickness valu
=> element.SetValue(HeaderPanelMarginProperty, value);

public static Thickness GetHeaderPanelMargin(DependencyObject element)
=> (Thickness) element.GetValue(HeaderPanelMarginProperty);
=> (Thickness)element.GetValue(HeaderPanelMarginProperty);

internal static Visibility GetBindableIsItemsHost(DependencyObject obj)
=> (Visibility)obj.GetValue(BindableIsItemsHostProperty);
Expand All @@ -45,4 +45,13 @@ private static void OnBindableIsItemsHostChanged(DependencyObject d, DependencyP
panel.IsItemsHost = (Visibility)e.NewValue == Visibility.Visible;
}
}

public static Cursor GetTabHeaderCursor(DependencyObject obj)
=> (Cursor)obj.GetValue(TabHeaderCursorProperty);

public static void SetTabHeaderCursor(DependencyObject obj, Cursor value)
=> obj.SetValue(TabHeaderCursorProperty, value);

public static readonly DependencyProperty TabHeaderCursorProperty =
DependencyProperty.RegisterAttached("TabHeaderCursor", typeof(Cursor), typeof(TabAssist), new PropertyMetadata(Cursors.Hand));
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
Duration="0" />
</Storyboard>
</ControlTemplate.Resources>
<Grid x:Name="Root">
<Grid x:Name="Root" Cursor="{Binding Path=(wpf:TabAssist.TabHeaderCursor), RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}">
<!-- This is the Header label ColorZone. -->
<wpf:ColorZone x:Name="ColorZoneHeader"
HorizontalAlignment="Stretch"
Expand Down Expand Up @@ -333,6 +333,9 @@
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True" SourceName="ColorZoneHeader">
<Setter TargetName="Root" Property="Background" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={x:Static converters:BrushOpacityConverter.Instance}, ConverterParameter=0.16}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.38" />
</Trigger>
Expand Down
Loading