From 80acfb6b1f0abe1c688639289dd908e589c5eb7d Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 14 Oct 2022 13:39:55 +0800 Subject: [PATCH] style: new style for page tab bar --- src/Views/Widgets/PageTabBar.xaml | 38 +++++++++++++++++----------- src/Views/Widgets/PageTabBar.xaml.cs | 17 +++++++++++++ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/Views/Widgets/PageTabBar.xaml b/src/Views/Widgets/PageTabBar.xaml index 588ca2ac..d2d30bee 100644 --- a/src/Views/Widgets/PageTabBar.xaml +++ b/src/Views/Widgets/PageTabBar.xaml @@ -7,7 +7,7 @@ xmlns:controls="clr-namespace:SourceGit.Views.Controls" mc:Ignorable="d" d:DesignHeight="28" d:DesignWidth="800"> - + @@ -19,10 +19,9 @@ Grid.Column="0" x:Name="leftScroller" Click="ScrollLeft" - Width="18" Padding="5" - HoverBackground="{DynamicResource Brush.Accent1}" - BorderBrush="{DynamicResource Brush.Border0}" - BorderThickness="0,0,1,0" + Width="18" Padding="6" + HoverBackground="{DynamicResource Brush.NewPageHover}" + BorderThickness="0" Icon="{StaticResource Icon.ScrollLeft}" WindowChrome.IsHitTestVisibleInChrome="True" Visibility="Collapsed"/> @@ -35,7 +34,8 @@ VerticalScrollBarVisibility="Disabled"> @@ -54,15 +54,15 @@ - - + + @@ -73,14 +73,24 @@ ToolTip="{DynamicResource Text.Close}" Icon="{StaticResource Icon.Close}" HoverBackground="{DynamicResource Brush.NewPageHover}"/> + + + + + + @@ -100,8 +110,7 @@ diff --git a/src/Views/Widgets/PageTabBar.xaml.cs b/src/Views/Widgets/PageTabBar.xaml.cs index 43da4f21..d921fabe 100644 --- a/src/Views/Widgets/PageTabBar.xaml.cs +++ b/src/Views/Widgets/PageTabBar.xaml.cs @@ -33,6 +33,12 @@ namespace SourceGit.Views.Widgets { get => bookmark; set => SetProperty(ref bookmark, value); } + + private bool isSeperatorVisible = false; + public bool IsSeperatorVisible { + get => isSeperatorVisible; + set => SetProperty(ref isSeperatorVisible, value); + } } /// @@ -217,6 +223,17 @@ namespace SourceGit.Views.Widgets { private void SelectionChanged(object sender, SelectionChangedEventArgs e) { var tab = container.SelectedItem as Tab; if (tab == null) return; + + for (int i = 0; i < Tabs.Count; i++) { + if (Tabs[i] == tab) { + tab.IsSeperatorVisible = false; + if (i > 0) Tabs[i - 1].IsSeperatorVisible = false; + } else { + Tabs[i].IsSeperatorVisible = true; + } + } + + RaiseEvent(new TabEventArgs(TabSelectedEvent, this, tab.Id)); }