WinRTXamlToolkit.Controls.Calendar.OnDisplayDateEndChanged C# (CSharp) Метод

OnDisplayDateEndChanged() приватный статический Метод

DisplayDateEndProperty property changed handler.
private static OnDisplayDateEndChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void
d Windows.UI.Xaml.DependencyObject Calendar that changed its DisplayDateEnd.
e Windows.UI.Xaml.DependencyPropertyChangedEventArgs The DependencyPropertyChangedEventArgs.
Результат void
        private static void OnDisplayDateEndChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Calendar c = d as Calendar;
            Debug.Assert(c != null, "c should not be null!");

            if (!c.IsHandlerSuspended(Calendar.DisplayDateEndProperty))
            {
                DateTime? newValue = e.NewValue as DateTime?;

                if (newValue.HasValue)
                {
                    // DisplayDateEnd coerces to the value of the
                    // SelectedDateMax if SelectedDateMax > DisplayDateEnd
                    DateTime? selectedDateMax = SelectedDateMax(c);

                    if (selectedDateMax.HasValue && DateTime.Compare(selectedDateMax.Value, newValue.Value) > 0)
                    {
                        c.DisplayDateEnd = selectedDateMax.Value;
                        return;
                    }

                    // if DisplayDateEnd < DisplayDateStart,
                    // DisplayDateEnd = DisplayDateStart
                    if (DateTime.Compare(newValue.Value, c.DisplayDateRangeStart) < 0)
                    {
                        c.DisplayDateEnd = c.DisplayDateStart;
                        return;
                    }

                    // If DisplayDate > DisplayDateEnd,
                    // DisplayDate = DisplayDateEnd
                    if (DateTimeHelper.CompareYearMonth(newValue.Value, c.DisplayDateInternal) < 0)
                    {
                        c.DisplayDate = newValue.Value;
                    }
                }
                c.UpdateMonths();
            }
        }