diff --git a/.github/workflows/get_versions.yml b/.github/workflows/get_versions.yml index 337509a1ca..85eed9fd22 100644 --- a/.github/workflows/get_versions.yml +++ b/.github/workflows/get_versions.yml @@ -23,9 +23,9 @@ jobs: getting_versions: env: #Update these base version numbers - mdix-version: "5.2.0" - mdix-colors-version: "5.2.0" - mdix-mahapps-version: "5.2.0" + mdix-version: "5.2.1" + mdix-colors-version: "5.2.1" + mdix-mahapps-version: "5.2.1" name: Set version numbers runs-on: ubuntu-latest defaults: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc53f460ed..6e15959652 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -313,6 +313,8 @@ jobs: Update-Version -Prefix "mdix-mahapps-version" - name: Open Pull Request + env: + GITHUB_TOKEN: ${{ secrets.SA_PAT }} run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" diff --git a/src/MainDemo.Wpf/FieldsLineUp.xaml b/src/MainDemo.Wpf/FieldsLineUp.xaml index d8d82fb829..cc16ac9768 100644 --- a/src/MainDemo.Wpf/FieldsLineUp.xaml +++ b/src/MainDemo.Wpf/FieldsLineUp.xaml @@ -159,6 +159,7 @@ + + + + + + + diff --git a/src/MainDemo.Wpf/FieldsLineUp.xaml.cs b/src/MainDemo.Wpf/FieldsLineUp.xaml.cs index 97ea7a074b..5ad4bcacac 100644 --- a/src/MainDemo.Wpf/FieldsLineUp.xaml.cs +++ b/src/MainDemo.Wpf/FieldsLineUp.xaml.cs @@ -73,6 +73,9 @@ private static void SetValue(Control control) { switch (control) { + case MaterialDesignThemes.Wpf.AutoSuggestBox autoSuggestBox: + autoSuggestBox.Text = nameof(MaterialDesignThemes.Wpf.AutoSuggestBox.Text); + break; case TextBox textBox: textBox.Text = nameof(TextBox.Text); break; diff --git a/src/MainDemo.Wpf/MenusAndToolBars.xaml b/src/MainDemo.Wpf/MenusAndToolBars.xaml index ae61fd818e..acd222f9e0 100644 --- a/src/MainDemo.Wpf/MenusAndToolBars.xaml +++ b/src/MainDemo.Wpf/MenusAndToolBars.xaml @@ -1,4 +1,4 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -345,6 +398,21 @@ + + + + + + + + + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/App.xaml b/src/MaterialDesign3.Demo.Wpf/App.xaml index eb02cdc8a1..b1731454db 100644 --- a/src/MaterialDesign3.Demo.Wpf/App.xaml +++ b/src/MaterialDesign3.Demo.Wpf/App.xaml @@ -124,6 +124,21 @@ + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml b/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml index c9c36351c5..ed90c7fa03 100644 --- a/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml +++ b/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml @@ -148,6 +148,7 @@ + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs b/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs index 052b836e39..84dfec9f58 100644 --- a/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs +++ b/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs @@ -73,6 +73,9 @@ private static void SetValue(Control control) { switch (control) { + case MaterialDesignThemes.Wpf.AutoSuggestBox autoSuggestBox: + autoSuggestBox.Text = nameof(MaterialDesignThemes.Wpf.AutoSuggestBox.Text); + break; case TextBox textBox: textBox.Text = nameof(TextBox.Text); break; diff --git a/src/MaterialDesign3.Demo.Wpf/MenusAndToolBars.xaml b/src/MaterialDesign3.Demo.Wpf/MenusAndToolBars.xaml index 797348de8b..f1bb219680 100644 --- a/src/MaterialDesign3.Demo.Wpf/MenusAndToolBars.xaml +++ b/src/MaterialDesign3.Demo.Wpf/MenusAndToolBars.xaml @@ -8,7 +8,10 @@ d:DesignHeight="300" d:DesignWidth="300" mc:Ignorable="d"> - + + + + @@ -57,6 +60,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The menu height matches with the parent panel height. Use the splitter to see the adaptive menu in action. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -178,28 +346,51 @@ - + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignThemes.Wpf/Converters/FloatingHintInitialHorizontalOffsetConverter.cs b/src/MaterialDesignThemes.Wpf/Converters/FloatingHintInitialHorizontalOffsetConverter.cs index bb1d5a4c88..c9bf535f65 100644 --- a/src/MaterialDesignThemes.Wpf/Converters/FloatingHintInitialHorizontalOffsetConverter.cs +++ b/src/MaterialDesignThemes.Wpf/Converters/FloatingHintInitialHorizontalOffsetConverter.cs @@ -19,7 +19,8 @@ public class FloatingHintInitialHorizontalOffsetConverter : IMultiValueConverter PrefixSuffixVisibility suffixVisibility, PrefixSuffixHintBehavior prefixHintBehavior, PrefixSuffixHintBehavior suffixHintBehavior, - HorizontalAlignment horizontalContentAlignment + HorizontalAlignment horizontalContentAlignment, + bool isEditable, ]) { return 0; @@ -37,8 +38,11 @@ double GetLeftOffset() return prefixVisibility switch { PrefixSuffixVisibility.WhenFocusedOrNonEmpty - when prefixHintBehavior == PrefixSuffixHintBehavior.AlignWithText => + when prefixHintBehavior == PrefixSuffixHintBehavior.AlignWithText && isEditable => prefixWidth + prefixMargin.Right, + PrefixSuffixVisibility.WhenFocusedOrNonEmpty + when prefixHintBehavior == PrefixSuffixHintBehavior.AlignWithPrefixSuffix && !isEditable => + -(prefixWidth + prefixMargin.Right), PrefixSuffixVisibility.Always when prefixHintBehavior == PrefixSuffixHintBehavior.AlignWithPrefixSuffix => -(prefixWidth + prefixMargin.Right), @@ -51,8 +55,11 @@ double GetRightOffset() return suffixVisibility switch { PrefixSuffixVisibility.WhenFocusedOrNonEmpty - when suffixHintBehavior == PrefixSuffixHintBehavior.AlignWithText => + when suffixHintBehavior == PrefixSuffixHintBehavior.AlignWithText && isEditable => -(suffixWidth + suffixMargin.Left), + PrefixSuffixVisibility.WhenFocusedOrNonEmpty + when suffixHintBehavior == PrefixSuffixHintBehavior.AlignWithPrefixSuffix && !isEditable => + suffixWidth + suffixMargin.Left, PrefixSuffixVisibility.Always when suffixHintBehavior == PrefixSuffixHintBehavior.AlignWithPrefixSuffix => suffixWidth + suffixMargin.Left, diff --git a/src/MaterialDesignThemes.Wpf/MenuAssist.cs b/src/MaterialDesignThemes.Wpf/MenuAssist.cs index d64952c876..1f6a5e7930 100644 --- a/src/MaterialDesignThemes.Wpf/MenuAssist.cs +++ b/src/MaterialDesignThemes.Wpf/MenuAssist.cs @@ -1,5 +1,3 @@ -using System.Windows.Media; - namespace MaterialDesignThemes.Wpf; public static class MenuAssist @@ -14,4 +12,15 @@ public static readonly DependencyProperty TopLevelMenuItemHeightProperty public static double GetTopLevelMenuItemHeight(DependencyObject element) => (double)element.GetValue(TopLevelMenuItemHeightProperty); public static void SetTopLevelMenuItemHeight(DependencyObject element, double value) => element.SetValue(TopLevelMenuItemHeightProperty, value); #endregion + + public static readonly DependencyProperty MenuItemsPresenterMarginProperty = + DependencyProperty.RegisterAttached( + "MenuItemsPresenterMargin", + typeof(Thickness), + typeof(MenuAssist), + new FrameworkPropertyMetadata(new Thickness(0, 16, 0, 16), FrameworkPropertyMetadataOptions.Inherits)); + public static Thickness GetMenuItemsPresenterMargin(DependencyObject obj) + => (Thickness)obj.GetValue(MenuItemsPresenterMarginProperty); + public static void SetMenuItemsPresenterMargin(DependencyObject obj, Thickness value) + => obj.SetValue(MenuItemsPresenterMarginProperty, value); } diff --git a/src/MaterialDesignThemes.Wpf/SmartHint.cs b/src/MaterialDesignThemes.Wpf/SmartHint.cs index c69eba8aac..41c8245531 100644 --- a/src/MaterialDesignThemes.Wpf/SmartHint.cs +++ b/src/MaterialDesignThemes.Wpf/SmartHint.cs @@ -258,7 +258,7 @@ private void RefreshState(bool useTransitions) string state = string.Empty; bool isEmpty = proxy.IsEmpty(); - bool isFocused = proxy.IsFocused(); + bool isFocused = HintHost?.IsKeyboardFocusWithin ?? proxy.IsFocused(); if (UseFloating) state = !isEmpty || isFocused ? HintFloatingPositionName : HintRestingPositionName; diff --git a/src/MaterialDesignThemes.Wpf/TextFieldAssist.cs b/src/MaterialDesignThemes.Wpf/TextFieldAssist.cs index 3fa0a3b856..aac1a63024 100644 --- a/src/MaterialDesignThemes.Wpf/TextFieldAssist.cs +++ b/src/MaterialDesignThemes.Wpf/TextFieldAssist.cs @@ -41,7 +41,7 @@ public static class TextFieldAssist public static void SetTextBoxViewVerticalAlignment(DependencyObject element, VerticalAlignment value) => element.SetValue(TextBoxViewVerticalAlignmentProperty, value); - public static VerticalAlignment GetTextBoxViewVerticalAlignment(DependencyObject element) => (VerticalAlignment) element.GetValue(TextBoxViewVerticalAlignmentProperty); + public static VerticalAlignment GetTextBoxViewVerticalAlignment(DependencyObject element) => (VerticalAlignment)element.GetValue(TextBoxViewVerticalAlignmentProperty); /// /// Controls the visibility of the underline decoration. @@ -172,7 +172,7 @@ public static void SetSuffixTextVisibility(DependencyObject element, PrefixSuffi => element.SetValue(SuffixTextVisibilityProperty, value); public static PrefixSuffixVisibility GetSuffixTextVisibility(DependencyObject element) - => (PrefixSuffixVisibility) element.GetValue(SuffixTextVisibilityProperty); + => (PrefixSuffixVisibility)element.GetValue(SuffixTextVisibilityProperty); /// /// SuffixTextHintBehavior dependency property. Controls how a floating hint aligns with respect to the text and suffix. @@ -184,7 +184,7 @@ public static void SetSuffixTextHintBehavior(DependencyObject element, PrefixSuf => element.SetValue(SuffixTextHintBehaviorProperty, value); public static PrefixSuffixHintBehavior GetSuffixTextHintBehavior(DependencyObject element) - => (PrefixSuffixHintBehavior) element.GetValue(SuffixTextHintBehaviorProperty); + => (PrefixSuffixHintBehavior)element.GetValue(SuffixTextHintBehaviorProperty); /// /// PrefixText dependency property @@ -208,7 +208,7 @@ public static void SetPrefixTextVisibility(DependencyObject element, PrefixSuffi => element.SetValue(PrefixTextVisibilityProperty, value); public static PrefixSuffixVisibility GetPrefixTextVisibility(DependencyObject element) - => (PrefixSuffixVisibility) element.GetValue(PrefixTextVisibilityProperty); + => (PrefixSuffixVisibility)element.GetValue(PrefixTextVisibilityProperty); /// /// PrefixTextHintBehavior dependency property. Controls how a floating hint aligns with respect to the text and prefix. @@ -234,6 +234,18 @@ public static void SetHasClearButton(DependencyObject element, bool value) public static bool GetHasClearButton(DependencyObject element) => (bool)element.GetValue(HasClearButtonProperty); + /// + /// Controls the size of the clear button. + /// + public static readonly DependencyProperty ClearButtonSizeProperty = DependencyProperty.RegisterAttached( + "ClearButtonSize", typeof(double), typeof(TextFieldAssist), new PropertyMetadata(16.0d)); + + public static void SetClearButtonSize(DependencyObject element, double value) + => element.SetValue(ClearButtonSizeProperty, value); + + public static double GetClearButtonSize(DependencyObject element) + => (double)element.GetValue(ClearButtonSizeProperty); + /// /// Controls visibility of the leading icon /// @@ -316,7 +328,7 @@ public static void SetIconVerticalAlignment(DependencyObject element, VerticalAl => element.SetValue(IconVerticalAlignmentProperty, value); public static VerticalAlignment GetIconVerticalAlignment(DependencyObject element) - => (VerticalAlignment) element.GetValue(IconVerticalAlignmentProperty); + => (VerticalAlignment)element.GetValue(IconVerticalAlignmentProperty); public static Style GetCharacterCounterStyle(DependencyObject obj) => (Style)obj.GetValue(CharacterCounterStyleProperty); @@ -373,14 +385,14 @@ public static Thickness GetOutlinedBorderActiveThickness(DependencyObject elemen public static void SetTextBoxLineCount(DependencyObject element, int value) => element.SetValue(TextBoxLineCountProperty, value); public static int GetTextBoxLineCount(DependencyObject element) - => (int) element.GetValue(TextBoxLineCountProperty); + => (int)element.GetValue(TextBoxLineCountProperty); public static readonly DependencyProperty TextBoxIsMultiLineProperty = DependencyProperty.RegisterAttached( "TextBoxIsMultiLine", typeof(bool), typeof(TextFieldAssist), new PropertyMetadata(false)); public static void SetTextBoxIsMultiLine(DependencyObject element, bool value) => element.SetValue(TextBoxIsMultiLineProperty, value); public static bool GetTextBoxIsMultiLine(DependencyObject element) - => (bool) element.GetValue(TextBoxIsMultiLineProperty); + => (bool)element.GetValue(TextBoxIsMultiLineProperty); #region Methods diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.AutoSuggestBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.AutoSuggestBox.xaml index ce94fdb964..ece9dd79f4 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.AutoSuggestBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.AutoSuggestBox.xaml @@ -71,29 +71,29 @@ + VerticalAlignment="Stretch" + Background="{DynamicResource MaterialDesign.Brush.TextBox.HoverBackground}" + CornerRadius="{TemplateBinding wpf:TextFieldAssist.TextFieldCornerRadius}" + RenderTransformOrigin="0.5,0.5" + Visibility="{TemplateBinding wpf:TextFieldAssist.RippleOnFocusEnabled, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}"> + Padding="{TemplateBinding Padding}" + wpf:BottomDashedLineAdorner.Brush="{TemplateBinding BorderBrush}" + wpf:BottomDashedLineAdorner.Thickness="{Binding RelativeSource={RelativeSource Self}, Path=BorderThickness}" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="{TemplateBinding wpf:TextFieldAssist.TextFieldCornerRadius}" + SnapsToDevicePixels="True"> + MinHeight="16" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> @@ -104,32 +104,14 @@ - - - - - - - - - - - - + Grid.Column="0" + Width="{TemplateBinding wpf:TextFieldAssist.LeadingIconSize}" + Height="{TemplateBinding wpf:TextFieldAssist.LeadingIconSize}" + Margin="0,0,6,0" + VerticalAlignment="{TemplateBinding wpf:TextFieldAssist.IconVerticalAlignment}" + Kind="{TemplateBinding wpf:TextFieldAssist.LeadingIcon}" + Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}" + Visibility="{TemplateBinding wpf:TextFieldAssist.HasLeadingIcon, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" /> + @@ -191,20 +174,38 @@ + Background="{TemplateBinding wpf:HintAssist.Background}" + CornerRadius="2"> + + + + + + + + + + + + + Grid.Column="3" + Margin="2,0,0,0" + VerticalAlignment="Center" + FontSize="{TemplateBinding FontSize}" + Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}" + Text="{TemplateBinding wpf:TextFieldAssist.SuffixText}"> @@ -227,20 +228,25 @@ Visibility="{TemplateBinding wpf:TextFieldAssist.HasTrailingIcon, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" /> @@ -283,11 +289,10 @@ CornerRadius="{TemplateBinding wpf:TextFieldAssist.UnderlineCornerRadius}" Visibility="{TemplateBinding wpf:TextFieldAssist.DecorationVisibility}" /> - + + Padding="{TemplateBinding Padding, Converter={StaticResource HelperTextMarginConverter}}" + Width="{Binding ActualWidth, ElementName=OuterBorder}"> diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml index bd56d8c73e..7b8c0f0fbf 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml @@ -416,6 +416,7 @@ + @@ -470,7 +471,8 @@ diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml index c742868407..dd3e686ef0 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml @@ -71,6 +71,7 @@ wpf:TextFieldAssist.TrailingIconSize="{TemplateBinding wpf:TextFieldAssist.TrailingIconSize}" wpf:TextFieldAssist.DecorationVisibility="{TemplateBinding wpf:TextFieldAssist.DecorationVisibility}" wpf:TextFieldAssist.HasClearButton="{TemplateBinding wpf:TextFieldAssist.HasClearButton}" + wpf:TextFieldAssist.ClearButtonSize="{TemplateBinding wpf:TextFieldAssist.ClearButtonSize}" wpf:TextFieldAssist.HasFilledTextField="{TemplateBinding wpf:TextFieldAssist.HasFilledTextField}" wpf:TextFieldAssist.HasOutlinedTextField="{TemplateBinding wpf:TextFieldAssist.HasOutlinedTextField}" wpf:TextFieldAssist.NewSpecHighlightingEnabled="{TemplateBinding wpf:TextFieldAssist.NewSpecHighlightingEnabled}" diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Menu.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Menu.xaml index 21b71ad276..ec889970af 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Menu.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Menu.xaml @@ -1,4 +1,4 @@ - @@ -186,7 +186,7 @@ Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" wpf:ScrollViewerAssist.IgnorePadding="{Binding Path=(wpf:ScrollViewerAssist.IgnorePadding), RelativeSource={RelativeSource TemplatedParent}}" wpf:ScrollViewerAssist.PaddingMode="{Binding Path=(wpf:ScrollViewerAssist.PaddingMode), RelativeSource={RelativeSource TemplatedParent}}"> - + - + + BasedOn="{StaticResource MaterialDesignFloatingHintUpDownBase}">