From 55579e1e3a85b50ea824da44caf04e0a9eed13ac Mon Sep 17 00:00:00 2001 From: Corvin Date: Tue, 17 Jun 2025 18:05:09 +0200 Subject: [PATCH 01/36] added AP to be able to swap between a scrollable and a wrapping header panel in a TabControl --- src/MainDemo.Wpf/Domain/TabsViewModel.cs | 6 +- src/MainDemo.Wpf/Tabs.xaml | 82 +++++++++++++++++++ src/MaterialDesignThemes.Wpf/TabAssist.cs | 18 +++- .../MaterialDesignTheme.TabControl.xaml | 82 ++++++++++++------- 4 files changed, 157 insertions(+), 31 deletions(-) diff --git a/src/MainDemo.Wpf/Domain/TabsViewModel.cs b/src/MainDemo.Wpf/Domain/TabsViewModel.cs index 08c32cc99b..26b1ad234a 100644 --- a/src/MainDemo.Wpf/Domain/TabsViewModel.cs +++ b/src/MainDemo.Wpf/Domain/TabsViewModel.cs @@ -4,10 +4,10 @@ namespace MaterialDesignDemo.Domain; -internal class TabsViewModel : ViewModelBase +internal partial class TabsViewModel : ObservableObject { public ObservableCollection CustomTabs { get; } - + public List LongList { get; } public CustomTab? SelectedTab { get; set; } public string? VeryLongText { get; set; } = @" @@ -47,6 +47,8 @@ public TabsViewModel() CustomContent = "Custom content 3", }, }; + + LongList = Enumerable.Range(1, 20).ToList(); } } diff --git a/src/MainDemo.Wpf/Tabs.xaml b/src/MainDemo.Wpf/Tabs.xaml index 60252e2997..b575c717ae 100644 --- a/src/MainDemo.Wpf/Tabs.xaml +++ b/src/MainDemo.Wpf/Tabs.xaml @@ -755,5 +755,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignThemes.Wpf/TabAssist.cs b/src/MaterialDesignThemes.Wpf/TabAssist.cs index 2dd368738f..9e6abf2fc2 100644 --- a/src/MaterialDesignThemes.Wpf/TabAssist.cs +++ b/src/MaterialDesignThemes.Wpf/TabAssist.cs @@ -1,5 +1,11 @@ namespace MaterialDesignThemes.Wpf; +public enum TabControlHeaderBehavior +{ + Scrolling, + Wrapping +} + public static class TabAssist { public static readonly DependencyProperty HasFilledTabProperty = DependencyProperty.RegisterAttached( @@ -27,7 +33,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); @@ -45,4 +51,14 @@ private static void OnBindableIsItemsHostChanged(DependencyObject d, DependencyP panel.IsItemsHost = (Visibility)e.NewValue == Visibility.Visible; } } + + public static TabControlHeaderBehavior GetHeaderBehavior(DependencyObject obj) + => (TabControlHeaderBehavior)obj.GetValue(HeaderBehaviorProperty); + + public static void SetHeaderBehavior(DependencyObject obj, TabControlHeaderBehavior value) + => obj.SetValue(HeaderBehaviorProperty, value); + + public static readonly DependencyProperty HeaderBehaviorProperty = + DependencyProperty.RegisterAttached("HeaderBehavior", typeof(TabControlHeaderBehavior), typeof(TabAssist), + new PropertyMetadata(TabControlHeaderBehavior.Scrolling)); } diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml index 87867f8aee..e801accd81 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TabControl.xaml @@ -31,57 +31,83 @@ - + + + - - + - - - + + + + + + + + + Padding="{TemplateBinding Padding}" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + Panel.ZIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Panel.ZIndex)}" + Background="{x:Null}" + Focusable="False"> + Margin="{TemplateBinding Padding}" + ContentSource="SelectedContent" + ContentStringFormat="{TemplateBinding SelectedContentStringFormat}" + ContentTemplate="{TemplateBinding SelectedContentTemplate}" + ContentTemplateSelector="{TemplateBinding SelectedContentTemplateSelector}" + Focusable="False" + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> + + + + + + + + + + From 4733a54434d5b0984cf630a538d88e41297ce27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Ehrenm=C3=BCller?= Date: Wed, 18 Jun 2025 19:25:56 +0200 Subject: [PATCH 02/36] Evaluate TextBox.LineCount only once in UpdateAttachedProperties (#3874) --- .../Behaviors/TextBoxLineCountBehavior.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MaterialDesignThemes.Wpf/Behaviors/TextBoxLineCountBehavior.cs b/src/MaterialDesignThemes.Wpf/Behaviors/TextBoxLineCountBehavior.cs index 5da4a5613b..2df10c85a3 100644 --- a/src/MaterialDesignThemes.Wpf/Behaviors/TextBoxLineCountBehavior.cs +++ b/src/MaterialDesignThemes.Wpf/Behaviors/TextBoxLineCountBehavior.cs @@ -18,8 +18,9 @@ private void UpdateAttachedProperties() associatedObject.Dispatcher .BeginInvoke(() => { - associatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, associatedObject.LineCount); - associatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, associatedObject.LineCount > 1); + int lineCount = associatedObject.LineCount; + associatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, lineCount); + associatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, lineCount > 1); }, DispatcherPriority.Background); } From 122a5345fbaf8231c8dbdb6203c765922492d779 Mon Sep 17 00:00:00 2001 From: Corvin <43533385+corvinsz@users.noreply.github.com> Date: Thu, 19 Jun 2025 06:42:56 +0200 Subject: [PATCH 03/36] added ToolTip demo page with a RichToolTip example. Applied new syntax in demo apps. Expose PopupAnimation in PopupBox (#3872) --- .../Domain/MainWindowViewModel.cs | 8 + src/MainDemo.Wpf/ToolTips.xaml | 167 ++++++++++++++++ src/MainDemo.Wpf/ToolTips.xaml.cs | 15 ++ .../Domain/MainWindowViewModel.cs | 180 ++++++++---------- src/MaterialDesign3.Demo.Wpf/ToolTips.xaml | 167 ++++++++++++++++ src/MaterialDesign3.Demo.Wpf/ToolTips.xaml.cs | 13 ++ .../Domain/ToolTipsViewModel.cs | 62 ++++++ src/MaterialDesignThemes.Wpf/PopupBox.cs | 19 +- .../Themes/MaterialDesignTheme.PopupBox.xaml | 5 +- 9 files changed, 530 insertions(+), 106 deletions(-) create mode 100644 src/MainDemo.Wpf/ToolTips.xaml create mode 100644 src/MainDemo.Wpf/ToolTips.xaml.cs create mode 100644 src/MaterialDesign3.Demo.Wpf/ToolTips.xaml create mode 100644 src/MaterialDesign3.Demo.Wpf/ToolTips.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Domain/ToolTipsViewModel.cs diff --git a/src/MainDemo.Wpf/Domain/MainWindowViewModel.cs b/src/MainDemo.Wpf/Domain/MainWindowViewModel.cs index 12e4238fc8..feb1fef7cf 100644 --- a/src/MainDemo.Wpf/Domain/MainWindowViewModel.cs +++ b/src/MainDemo.Wpf/Domain/MainWindowViewModel.cs @@ -450,6 +450,14 @@ private static IEnumerable GenerateDemoItems(ISnackbarMessageQueue sna DocumentationLink.ApiLink(), DocumentationLink.ApiLink() ]); + + yield return new DemoItem( + "ToolTips", + typeof(ToolTips), + [ + DocumentationLink.DemoPageLink(), + DocumentationLink.DemoPageLink("Demo View Model", "Domain"), + ]); } private bool DemoItemsFilter(object obj) diff --git a/src/MainDemo.Wpf/ToolTips.xaml b/src/MainDemo.Wpf/ToolTips.xaml new file mode 100644 index 0000000000..df0cbf315b --- /dev/null +++ b/src/MainDemo.Wpf/ToolTips.xaml @@ -0,0 +1,167 @@ + + + + + + + + 0,16,0,0 + + + + + + + + +