From 048e20de72aef9af85e6b9e560f9ee739f7cabb5 Mon Sep 17 00:00:00 2001 From: Corvin <43533385+corvinsz@users.noreply.github.com> Date: Thu, 15 Oct 2026 18:17:53 +0200 Subject: [PATCH 1/3] feat(TabControl): Allow changing NavigationButtonStyle Adds a new attached property TabAssist.NavigationButtonStyle so users can change the style of the navigation buttons in the TabControl. Additionally the default style for the button was changed to the MaterialDesignIconForegroundButton --- src/MainDemo.Wpf/Tabs.xaml | 6 +- .../NavigationButtonStyleExample.xaml | 58 +++++++++++++++++++ .../NavigationButtonStyleExample.xaml.cs | 12 ++++ src/MaterialDesignThemes.Wpf/TabAssist.cs | 8 +++ .../MaterialDesignTheme.TabControl.xaml | 30 +++++----- 5 files changed, 97 insertions(+), 17 deletions(-) create mode 100644 src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml.cs diff --git a/src/MainDemo.Wpf/Tabs.xaml b/src/MainDemo.Wpf/Tabs.xaml index c09a30d49b..6b8c7ba06d 100644 --- a/src/MainDemo.Wpf/Tabs.xaml +++ b/src/MainDemo.Wpf/Tabs.xaml @@ -4,6 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:domain="clr-namespace:MaterialDesignDemo.Domain" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:sharedTabControls="clr-namespace:MaterialDesignDemo.Shared.Examples.TabControls;assembly=MaterialDesignDemo.Shared" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML" d:DataContext="{d:DesignInstance Type=domain:TabsViewModel, @@ -1098,6 +1099,9 @@ - + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml b/src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml new file mode 100644 index 0000000000..f6905e3bd6 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml.cs new file mode 100644 index 0000000000..ba9eee5d01 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/TabControls/NavigationButtonStyleExample.xaml.cs @@ -0,0 +1,12 @@ +namespace MaterialDesignDemo.Shared.Examples.TabControls; + +/// +/// Interaction logic for NavigationButtonStyleExample.xaml +/// +public partial class NavigationButtonStyleExample : UserControl +{ + public NavigationButtonStyleExample() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignThemes.Wpf/TabAssist.cs b/src/MaterialDesignThemes.Wpf/TabAssist.cs index 8769559892..3ad34ddcf7 100644 --- a/src/MaterialDesignThemes.Wpf/TabAssist.cs +++ b/src/MaterialDesignThemes.Wpf/TabAssist.cs @@ -154,6 +154,14 @@ public static void SetScrollDuration(DependencyObject obj, TimeSpan value) public static readonly DependencyProperty ScrollDurationProperty = DependencyProperty.RegisterAttached("ScrollDuration", typeof(TimeSpan), typeof(TabAssist), new PropertyMetadata(TimeSpan.Zero)); + + public static Style GetNavigationButtonStyle(TabControl obj) + => (Style)obj.GetValue(NavigationButtonStyleProperty); + + public static void SetNavigationButtonStyle(TabControl obj, Style value) + => obj.SetValue(NavigationButtonStyleProperty, value); + public static readonly DependencyProperty NavigationButtonStyleProperty = + DependencyProperty.RegisterAttached("NavigationButtonStyle", typeof(Style), typeof(TabAssist), new PropertyMetadata(null)); } public enum NavigationPanelPlacement diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml index 1568a277ee..31e9217a9f 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml @@ -9,6 +9,7 @@ +