public override void OnApplyTemplate() { base.OnApplyTemplate(); UnsubscribeEvents(); _countPerPageTextBox = GetTemplateChild(CountPerPageTextBoxTemplateName) as NumericBox; _jumpPageTextBox = GetTemplateChild(JustPageTextBoxTemplateName) as NumericBox; _listBox = GetTemplateChild(ListBoxTemplateName) as ListBox; Init(); SubscribeEvents(); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (_yearBox != null) { _yearBox.ValueChanged -= _yearBox_ValueChanged; } if (_monthBox != null) { _monthBox.ValueChanged -= _monthBox_ValueChanged; } if (_dayBox != null) { _dayBox.ValueChanged -= _dayBox_ValueChanged; } if (_hourBox != null) { _hourBox.ValueChanged -= _hourBox_ValueChanged; } if (_minuteBox != null) { _minuteBox.ValueChanged -= _minuteBox_ValueChanged; } if (_secondBox != null) { _secondBox.ValueChanged -= _secondBox_ValueChanged; } if (_calendar != null) { _calendar.SelectedDatesChanged -= _calendar_SelectedDatesChanged; } _yearBox = GetTemplateChild(YearBoxTemplateName) as NumericBox; _monthBox = GetTemplateChild(MonthBoxTemplateName) as NumericBox; _dayBox = GetTemplateChild(DayBoxTemplateName) as NumericBox; _hourBox = GetTemplateChild(HourBoxTemplateName) as NumericBox; _minuteBox = GetTemplateChild(MinuteBoxTemplateName) as NumericBox; _secondBox = GetTemplateChild(SecondBoxTemplateName) as NumericBox; _calendar = GetTemplateChild(CalendarTemplateName) as Calendar; if (_yearBox != null) { _yearBox.ValueChanged += _yearBox_ValueChanged; } if (_monthBox != null) { _monthBox.ValueChanged += _monthBox_ValueChanged; } if (_dayBox != null) { _dayBox.ValueChanged += _dayBox_ValueChanged; } if (_hourBox != null) { _hourBox.ValueChanged += _hourBox_ValueChanged; } if (_minuteBox != null) { _minuteBox.ValueChanged += _minuteBox_ValueChanged; } if (_secondBox != null) { _secondBox.ValueChanged += _secondBox_ValueChanged; } if (_calendar != null) { _calendar.SelectedDatesChanged += _calendar_SelectedDatesChanged; } UpdateDateTime(); }