From e5082128a31caff079600b57c3311ce1faab422a Mon Sep 17 00:00:00 2001 From: Nicolai Henriksen Date: Fri, 5 Aug 2022 19:23:14 +0200 Subject: [PATCH 1/6] Added BorderThickness attached DP for outlined date/time pickers --- MainDemo.Wpf/Pickers.xaml | 54 +++++++++++++++++++ ...imePickerActiveBorderThicknessConverter.cs | 24 +++++++++ MaterialDesignThemes.Wpf/DatePickerAssist.cs | 33 ++++++++++++ .../MaterialDesignTheme.DatePicker.xaml | 36 ++++++++++--- .../MaterialDesignTheme.TimePicker.xaml | 38 ++++++++++--- MaterialDesignThemes.Wpf/TimePickerAssist.cs | 33 ++++++++++++ 6 files changed, 203 insertions(+), 15 deletions(-) create mode 100644 MaterialDesignThemes.Wpf/Converters/OutlinedDateTimePickerActiveBorderThicknessConverter.cs create mode 100644 MaterialDesignThemes.Wpf/DatePickerAssist.cs create mode 100644 MaterialDesignThemes.Wpf/TimePickerAssist.cs diff --git a/MainDemo.Wpf/Pickers.xaml b/MainDemo.Wpf/Pickers.xaml index eb718f0f84..ada98ecbd5 100644 --- a/MainDemo.Wpf/Pickers.xaml +++ b/MainDemo.Wpf/Pickers.xaml @@ -198,6 +198,60 @@ materialDesign:HintAssist.HelperText="Helper text" Style="{StaticResource MaterialDesignOutlinedDatePicker}"/> + + + + + + + + + + + + + + + + throw new NotImplementedException(); +} \ No newline at end of file diff --git a/MaterialDesignThemes.Wpf/DatePickerAssist.cs b/MaterialDesignThemes.Wpf/DatePickerAssist.cs new file mode 100644 index 0000000000..5729032aae --- /dev/null +++ b/MaterialDesignThemes.Wpf/DatePickerAssist.cs @@ -0,0 +1,33 @@ +namespace MaterialDesignThemes.Wpf; + +public static class DatePickerAssist +{ + private static Thickness DefaultOutlinedBorderInactiveThickness { get; } = new(1); + private static Thickness DefaultOutlinedBorderActiveThickness { get; } = new(2); + + public static readonly DependencyProperty OutlinedBorderInactiveThicknessProperty = DependencyProperty.RegisterAttached( + "OutlinedBorderInactiveThickness", typeof(Thickness), typeof(DatePickerAssist), new FrameworkPropertyMetadata(DefaultOutlinedBorderInactiveThickness, FrameworkPropertyMetadataOptions.Inherits)); + + public static void SetOutlinedBorderInactiveThickness(DependencyObject element, Thickness value) + { + element.SetValue(OutlinedBorderInactiveThicknessProperty, value); + } + + public static Thickness GetOutlinedBorderInactiveThickness(DependencyObject element) + { + return (Thickness) element.GetValue(OutlinedBorderInactiveThicknessProperty); + } + + public static readonly DependencyProperty OutlinedBorderActiveThicknessProperty = DependencyProperty.RegisterAttached( + "OutlinedBorderActiveThickness", typeof(Thickness), typeof(DatePickerAssist), new FrameworkPropertyMetadata(DefaultOutlinedBorderActiveThickness, FrameworkPropertyMetadataOptions.Inherits)); + + public static void SetOutlinedBorderActiveThickness(DependencyObject element, Thickness value) + { + element.SetValue(OutlinedBorderActiveThicknessProperty, value); + } + + public static Thickness GetOutlinedBorderActiveThickness(DependencyObject element) + { + return (Thickness) element.GetValue(OutlinedBorderActiveThicknessProperty); + } +} \ No newline at end of file diff --git a/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml index e258e470a5..0da4fd8e8a 100644 --- a/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml +++ b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DatePicker.xaml @@ -17,6 +17,7 @@ +