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

OnApplyTemplate() protected method

Builds the visual tree for the T:WinRTXamlToolkit.Controls.Calendar when a new template is applied.
protected OnApplyTemplate ( ) : void
return void
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Root = GetTemplateChild(ElementRoot) as Panel;

            SelectedMonth = DisplayDate;
            SelectedYear = DisplayDate;

            if (Root != null)
            {
                CalendarItem month = GetTemplateChild(ElementMonth) as CalendarItem;

                if (month != null)
                {
                    month.Owner = this;

                    if (CalendarItemStyle != null)
                    {
                        month.Style = CalendarItemStyle;
                    }
                    // REMOVE_RTM:If MultiCalendar is supported, while creating other months the _DisplayDate property should be changed
                }
            }

            SizeChanged += new SizeChangedEventHandler(Calendar_SizeChanged);
            KeyDown += new KeyEventHandler(Calendar_KeyDown);
            KeyUp += new KeyEventHandler(Calendar_KeyUp);
        }