protected override void OnApplyTemplate() { base.OnApplyTemplate(); LayoutRoot = GetTemplateChild("LayoutRoot") as Grid; header = GetTemplateChild("header") as CalendarHeader; yearheader = GetTemplateChild("yearheader") as CalendarYearHeadar; semanticzoomDate = GetTemplateChild("semanticzoomDate") as SemanticZoom; gridviewDays = GetTemplateChild("gridviewDays") as GridView; gridviewMonths = GetTemplateChild("gridviewMonths") as GridView; Days = new ObservableCollection <Day>(); Months = new ObservableCollection <Month>(); Years = new ObservableCollection <Year>(); this.Loaded += Calendar_Loaded; this.header.LeftButtonClick += header_LeftButtonClick; this.header.RightButtonClick += header_RightButtonClick; this.yearheader.LeftButtonClick += yearheader_LeftButtonClick; this.yearheader.RightButtonClick += yearheader_RightButtonClick; this.gridviewDays.ItemClick += gridviewDays_ItemClick; this.semanticzoomDate.ViewChangeStarted += semanticzoomDate_ViewChangeStarted; }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); LayoutRoot = GetTemplateChild("LayoutRoot") as Grid; header = GetTemplateChild("header") as CalendarHeader; yearheader = GetTemplateChild("yearheader") as CalendarYearHeadar; semanticzoomDate = GetTemplateChild("semanticzoomDate") as SemanticZoom; gridviewDays = GetTemplateChild("gridviewDays") as GridView; gridviewMonths = GetTemplateChild("gridviewMonths") as GridView; Days = new ObservableCollection<Day>(); Months = new ObservableCollection<Month>(); Years = new ObservableCollection<Year>(); this.Loaded += Calendar_Loaded; this.header.LeftButtonClick += header_LeftButtonClick; this.header.RightButtonClick += header_RightButtonClick; this.yearheader.LeftButtonClick += yearheader_LeftButtonClick; this.yearheader.RightButtonClick += yearheader_RightButtonClick; this.gridviewDays.ItemClick += gridviewDays_ItemClick; this.semanticzoomDate.ViewChangeStarted += semanticzoomDate_ViewChangeStarted; }