From 70e6746229cb35ec5dc4c50b01ff1eedd97ee5a2 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Wed, 12 May 2021 20:24:20 +0430 Subject: [PATCH] Add PersianDatePicker ConfirmButtonText Property --- .../Persian/PersianCalendarWithClock.cs | 3 +- .../Controls/Persian/PersianDateTimePicker.cs | 16 ++++++ .../Styles/Base/DateTimePickerBaseStyle.xaml | 54 ------------------- .../HandyControl_Shared/Themes/Theme.xaml | 4 +- 4 files changed, 20 insertions(+), 57 deletions(-) diff --git a/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianCalendarWithClock.cs b/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianCalendarWithClock.cs index bea81ae15..a368a779a 100644 --- a/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianCalendarWithClock.cs +++ b/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianCalendarWithClock.cs @@ -1,5 +1,6 @@  using HandyControl.Data; +using HandyControl.Properties.Langs; using System; using System.Collections.Generic; using System.Windows; @@ -100,7 +101,7 @@ public bool ShowConfirmButton "SelectedDateTime", typeof(DateTime?), typeof(PersianCalendarWithClock), new PropertyMetadata(default(DateTime?), OnSelectedDateTimeChanged)); public static readonly DependencyProperty ConfirmButtonTextProperty = DependencyProperty.Register( - "ConfirmButtonText", typeof(string), typeof(PersianCalendarWithClock), new PropertyMetadata("Confirm")); + "ConfirmButtonText", typeof(string), typeof(PersianCalendarWithClock), new PropertyMetadata(Lang.Confirm)); public string ConfirmButtonText { diff --git a/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianDateTimePicker.cs b/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianDateTimePicker.cs index 95055b12c..a67e9ac80 100644 --- a/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianDateTimePicker.cs +++ b/src/Shared/HandyControl_Shared/HandyControls/Controls/Persian/PersianDateTimePicker.cs @@ -62,6 +62,15 @@ public Brush CaretBrush set => SetValue(CaretBrushProperty, value); } + public static readonly DependencyProperty ConfirmButtonTextProperty = + PersianCalendarWithClock.ConfirmButtonTextProperty.AddOwner(typeof(PersianDateTimePicker)); + + public string ConfirmButtonText + { + get { return (string) GetValue(ConfirmButtonTextProperty); } + set { SetValue(ConfirmButtonTextProperty, value); } + } + #region Constants private const string ElementRoot = "PART_Root"; @@ -457,6 +466,13 @@ private void InitCalendarWithClock() { ShowConfirmButton = true }; + + _calendarWithClock.SetBinding(PersianCalendarWithClock.ConfirmButtonTextProperty, new Binding + { + Path = new PropertyPath("ConfirmButtonText"), + Source = this + }); + _calendarWithClock.SelectedDateTimeChanged += CalendarWithClock_SelectedDateTimeChanged; _calendarWithClock.Confirmed += CalendarWithClock_Confirmed; } diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml index f233595a9..b9ab3638c 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DateTimePickerBaseStyle.xaml @@ -393,60 +393,6 @@ - - diff --git a/src/Shared/HandyControl_Shared/Themes/Theme.xaml b/src/Shared/HandyControl_Shared/Themes/Theme.xaml index 08ce6b059..623c2b1ed 100644 --- a/src/Shared/HandyControl_Shared/Themes/Theme.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Theme.xaml @@ -5579,7 +5579,7 @@ - + @@ -5675,7 +5675,7 @@ - +