/// <summary> /// Prepares the specified element to display the specified item. /// </summary> /// <param name="element">Element used to display the specified item.</param> /// <param name="item">Specified item.</param> protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); StyleManager.SetThemeFromParent(element, this); RadMenuItem menuItem = element as RadMenuItem; if (menuItem != null) { menuItem.Menu = this; menuItem.UpdateRole(); } }
/// <summary> /// Called when ApplyTemplate is called. /// </summary> public override void OnApplyTemplate() { var window = this.GetParent<RadWindow>(); if (window != null) { StyleManager.SetThemeFromParent(this, window); } base.OnApplyTemplate(); var box = this.GetTemplateChild("PART_EditableTextBox") as TextBox; if (box != null) { box.LostFocus += this.OnEditableTextBoxLostFocus; } }
/// <summary> /// Prepares the specified element to display the specified item. /// </summary> /// <param name="element">Element used to display the specified item.</param> /// <param name="item">Specified item.</param> protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); RadClockItem clockItem = element as RadClockItem; if (clockItem == null) { return; } clockItem.ClockControl = this; if (clockItem != item) { TimeSpan currentItem = TimeSpan.Parse(item.ToString()); clockItem.Content = string.Format(string.Format(this.GetCultureToUse(), "{0:t}", DateTime.MinValue.Add(currentItem))); } StyleManager.SetThemeFromParent(clockItem, this); }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate />. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.schedulerTimePicker = (SchedulerTimePicker)this.Template.FindName(TimePickerControlName, this); this.datePicker = (RadDatePicker)this.Template.FindName(DatePickerControlName, this); this.datePicker.SelectionChanged += this.OnDatePickerSelectionChanged; this.schedulerTimePicker.SelectedTimeChanged += this.OnTimePickerSelectedTimeChanged; var window = this.GetParent <RadWindow>(); if (this.datePicker != null && window != null) { this.datePicker.Culture = LocalizationManager.DefaultCulture; StyleManager.SetThemeFromParent(this.datePicker, window); } if (this.schedulerTimePicker != null && window != null) { StyleManager.SetThemeFromParent(this.schedulerTimePicker, window); } this.UpdateSelection(); }
/// <summary> /// Search for template parts and initialize them. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.combo = this.GetTemplateChild(ComboBoxName) as RadComboBox; var window = this.GetParent <RadWindow>(); if (this.combo != null && window != null) { StyleManager.SetThemeFromParent(this.combo, window); this.combo.ApplyTemplate(); var textBox = this.combo.Template.FindName("PART_EditableTextBox", this.combo) as TextBox; if (textBox != null) { textBox.LostFocus -= this.OnEditableTextBoxLostFocus; textBox.LostFocus += this.OnEditableTextBoxLostFocus; } } this.RebindCombo(); }