WinRTXamlToolkit.Controls.Calendar.OnCalendarButtonStyleChanged C# (CSharp) Method

OnCalendarButtonStyleChanged() private static method

Inherited code: Requires comment.
private static OnCalendarButtonStyleChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void
d Windows.UI.Xaml.DependencyObject Inherited code: Requires comment 1.
e Windows.UI.Xaml.DependencyPropertyChangedEventArgs Inherited code: Requires comment 2.
return void
        private static void OnCalendarButtonStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Style newStyle = e.NewValue as Style;
            Style oldStyle = e.OldValue as Style;
            Calendar c = d as Calendar;

            if (newStyle != null && c != null)
            {
                CalendarItem monthControl = c.MonthControl;

                if (monthControl != null && monthControl.YearView != null)
                {
                    foreach (UIElement child in monthControl.YearView.Children)
                    {
                        CalendarButton calendarButton = child as CalendarButton;

                        if (calendarButton != null)
                        {
                            EnsureCalendarButtonStyle(calendarButton, oldStyle, newStyle);
                        }
                    }
                }
            }
        }