diff --git a/SharedResources/Panuon.UI.Silver/Controls/CalendarX.cs b/SharedResources/Panuon.UI.Silver/Controls/CalendarX.cs index 494f174b05dba0141e169252678b84a531738013..0855b144f0af09354d4a81293718c08386e450a6 100644 --- a/SharedResources/Panuon.UI.Silver/Controls/CalendarX.cs +++ b/SharedResources/Panuon.UI.Silver/Controls/CalendarX.cs @@ -280,6 +280,7 @@ namespace Panuon.UI.Silver public static readonly DependencyProperty SelectedDateProperty = DependencyProperty.Register("SelectedDate", typeof(DateTime?), typeof(CalendarX), new PropertyMetadata(null, OnSelectedDateChanged)); + #endregion #region SelectedDates @@ -683,6 +684,17 @@ namespace Panuon.UI.Silver private void OnSelectedDateChanged() { + _isInternalSet = true; + if (SelectedDates == null) + { + SelectedDates = new ObservableCollection(); + } + if (SelectedDate != null && !SelectedDates.Contains((DateTime)SelectedDate)) + { + SelectedDates.Add((DateTime)SelectedDate); + } + _isInternalSet = false; + if (_dayPresenter == null) { return; @@ -690,16 +702,7 @@ namespace Panuon.UI.Silver if (!_isInternalSet) { - if (SelectedDates == null) - { - SelectedDates = new ObservableCollection(); - } - if (SelectedDate != null && !SelectedDates.Contains((DateTime)SelectedDate)) - { - _isInternalSet = true; - SelectedDates.Add((DateTime)SelectedDate); - _isInternalSet = false; - } + var date = SelectedDate ?? new DateTime(CurrentYear, CurrentMonth, 1); UpdateDays(date.Year, date.Month); UpdateMonths(date.Year, date.Month); @@ -804,7 +807,7 @@ namespace Panuon.UI.Silver SelectedDate = MinDate; SelectedDates.Add((DateTime)SelectedDate); } - else if(SelectedDate != null && MaxDate != null && SelectedDate > MaxDate) + else if (SelectedDate != null && MaxDate != null && SelectedDate > MaxDate) { var date = (DateTime)SelectedDate; if (SelectedDates.Contains(date)) diff --git a/SharedResources/Panuon.UI.Silver/Controls/DateTimePicker.cs b/SharedResources/Panuon.UI.Silver/Controls/DateTimePicker.cs index 4c19a222fa8359624b6adfa4f2bf6ff179500c5e..006326d90948963ba1c1f4e842dfce9358094699 100644 --- a/SharedResources/Panuon.UI.Silver/Controls/DateTimePicker.cs +++ b/SharedResources/Panuon.UI.Silver/Controls/DateTimePicker.cs @@ -28,6 +28,7 @@ namespace Panuon.UI.Silver #endregion #region Overrides + public override void OnApplyTemplate() { base.OnApplyTemplate(); @@ -40,6 +41,7 @@ namespace Panuon.UI.Silver LimitCalendarXDate(); LimitTimeSelectorTime(); + OnSelectedDateTimeChanged(); } #endregion @@ -355,7 +357,7 @@ namespace Panuon.UI.Silver } break; } - + _isInternalSet = false; } @@ -392,7 +394,7 @@ namespace Panuon.UI.Silver else { var minDateTime = (DateTime)MinDateTime; - if (Mode == DateTimePickerMode.Time|| (_calendarX.SelectedDate != null && minDateTime.Date.Equals(((DateTime)_calendarX.SelectedDate).Date))) + if (Mode == DateTimePickerMode.Time || (_calendarX.SelectedDate != null && minDateTime.Date.Equals(((DateTime)_calendarX.SelectedDate).Date))) { if (_timeSelector.MinTime == null) { @@ -472,10 +474,14 @@ namespace Panuon.UI.Silver } private void OnSelectedDateTimeChanged() { + if (_calendarX == null) + { + return; + } if (SelectedDateTime == null) { _calendarX.SelectedDate = null; - _timeSelector.SelectedTime = new DateTime(0, 0, 0); + _timeSelector.SelectedTime = new DateTime(1, 1, 1); } else { diff --git a/SharedResources/Panuon.UI.Silver/Controls/PopupX.cs b/SharedResources/Panuon.UI.Silver/Controls/PopupX.cs index 6f27473afdde0323b513516c9a769cc8ced449ed..7baa3b337040cad45d708f93d073a5468b275590 100644 --- a/SharedResources/Panuon.UI.Silver/Controls/PopupX.cs +++ b/SharedResources/Panuon.UI.Silver/Controls/PopupX.cs @@ -86,7 +86,7 @@ namespace Panuon.UI.Silver #region Overrides protected override void OnOpened(EventArgs e) { - if(Child != null) + if (Child != null) { if (_popupHwnd == IntPtr.Zero) { @@ -183,21 +183,21 @@ namespace Panuon.UI.Silver private void UpdateActualPlacement() { var target = PlacementTarget ?? VisualTreeHelper.GetParent(this) as UIElement; - if(Child == null) + if (Child == null) { return; } var location = Child.TranslatePoint(new Point(0, 0), target); - if(RelativePosition.X != location.X || RelativePosition.Y != location.Y) + if (RelativePosition.X != location.X || RelativePosition.Y != location.Y) { RelativePosition = location; } var centerX = location.X + (Child.RenderSize.Width - target.RenderSize.Width) / 2; - if(centerX > -2 && centerX < 2) + if (centerX > -2 && centerX < 2) { - if(location.Y < 0) + if (location.Y < 0) { ActualPlacement = PopupXPlacement.Top; } @@ -206,7 +206,7 @@ namespace Panuon.UI.Silver ActualPlacement = PopupXPlacement.Bottom; } } - else if(centerX > 2) + else if (centerX > 2) { if (location.Y > 0) { diff --git a/SharedResources/Panuon.UI.Silver/Themes/Controls/DateTimePicker.xaml b/SharedResources/Panuon.UI.Silver/Themes/Controls/DateTimePicker.xaml index ceaaebb9317dec7fe85da4a109cfa06a16d42b75..9c996fa1b315a483587996df48766e69e5ddfcf5 100644 --- a/SharedResources/Panuon.UI.Silver/Themes/Controls/DateTimePicker.xaml +++ b/SharedResources/Panuon.UI.Silver/Themes/Controls/DateTimePicker.xaml @@ -231,7 +231,7 @@ HorizontalOffset="-5" AllowsTransparency="True" Focusable="False" - MaxHeight="{TemplateBinding MaxDropDownHeight}" + Height="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, Converter={StaticResource {x:Static rs:Converters.DoublePlusConverter}}, ConverterParameter=10, ElementName=TgbContent, Mode=OneWay}"> - + + Style="{TemplateBinding CalendarXStyle}" /> + Margin="5,0" /> + Style="{TemplateBinding TimeSelectorStyle}" /> @@ -315,11 +315,11 @@ Property="Mode" Value="YearMonth" /> - + - + diff --git a/UIBrowser/UIBrowser/Views/ShellView.xaml b/UIBrowser/UIBrowser/Views/ShellView.xaml index 0d07b327752bf43ee6cdc26bf1b5ab6eddcf8f16..24e44a2afb62fbe1c8a0943df2abe2a405588db9 100644 --- a/UIBrowser/UIBrowser/Views/ShellView.xaml +++ b/UIBrowser/UIBrowser/Views/ShellView.xaml @@ -94,5 +94,10 @@ +