From e44eaf9a24a97f4fce0614aea6517366aa22ed0c Mon Sep 17 00:00:00 2001 From: Benedikt Schroeder Date: Thu, 22 Nov 2018 12:07:47 +0100 Subject: [PATCH] Improved default control template for TabControl --- .../ControlCatalog/Pages/TabControlPage.xaml | 35 +++---------------- samples/ControlCatalog/SideBar.xaml | 3 +- .../Generators/TabItemContainerGenerator.cs | 2 ++ src/Avalonia.Controls/TabItem.cs | 8 +---- src/Avalonia.Themes.Default/TabControl.xaml | 19 ++++++---- src/Avalonia.Themes.Default/TabItem.xaml | 8 ++++- 6 files changed, 28 insertions(+), 47 deletions(-) diff --git a/samples/ControlCatalog/Pages/TabControlPage.xaml b/samples/ControlCatalog/Pages/TabControlPage.xaml index 5b10e7d790..430ac28347 100644 --- a/samples/ControlCatalog/Pages/TabControlPage.xaml +++ b/samples/ControlCatalog/Pages/TabControlPage.xaml @@ -26,43 +26,19 @@ - - - - - + This is the first page in the TabControl. - - - - - + This is the second page in the TabControl. - - - - - + You should not see this. @@ -82,10 +58,7 @@ + Text="{Binding Header}"> diff --git a/samples/ControlCatalog/SideBar.xaml b/samples/ControlCatalog/SideBar.xaml index 3ec8e43b07..ae9ab7f6a6 100644 --- a/samples/ControlCatalog/SideBar.xaml +++ b/samples/ControlCatalog/SideBar.xaml @@ -17,8 +17,7 @@ VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" Background="{TemplateBinding Background}"> IsSelectedProperty = ListBoxItem.IsSelectedProperty.AddOwner(); - private TabControl _parentTabControl; - /// /// Initializes static members of the class. /// @@ -56,11 +54,7 @@ namespace Avalonia.Controls set { SetValue(IsSelectedProperty, value); } } - internal TabControl ParentTabControl - { - get => _parentTabControl; - set => _parentTabControl = value; - } + internal TabControl ParentTabControl { get; set; } private void UpdateHeader(AvaloniaPropertyChangedEventArgs obj) { diff --git a/src/Avalonia.Themes.Default/TabControl.xaml b/src/Avalonia.Themes.Default/TabControl.xaml index 28de70ebb6..a492698feb 100644 --- a/src/Avalonia.Themes.Default/TabControl.xaml +++ b/src/Avalonia.Themes.Default/TabControl.xaml @@ -1,10 +1,5 @@ - + + + + diff --git a/src/Avalonia.Themes.Default/TabItem.xaml b/src/Avalonia.Themes.Default/TabItem.xaml index 6d7cdea1fd..fcdb76524e 100644 --- a/src/Avalonia.Themes.Default/TabItem.xaml +++ b/src/Avalonia.Themes.Default/TabItem.xaml @@ -3,9 +3,11 @@ + + - @@ -36,4 +39,7 @@ +