internal void SelectItem(RadClockItem item) { if (item != null) { this.NotifyClockItemSelected(item); item.Focus(); } }
private static void OnSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RadClockItem item = d as RadClockItem; if (item != null) { item.IsSelected = (bool)e.NewValue; } }
/// <summary> /// When overridden in a derived class, undoes the effects of the <see cref="M:System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(System.Windows.DependencyObject,System.Object)"/> method. /// </summary> /// <param name="element">The container element.</param> /// <param name="item">The Item.</param> protected override void ClearContainerForItemOverride(DependencyObject element, object item) { RadClockItem clockItem = element as RadClockItem; if (clockItem != null) { clockItem.ClockControl = null; } base.ClearContainerForItemOverride(element, item); }
/// <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); }
internal void NotifyClockItemSelected(RadClockItem clockItem) { if (this.SelectedClockItem != clockItem) { if (this.SelectedClockItem != null) { this.SelectedClockItem.IsSelected = false; } } if (clockItem != null) { this.selectedClockItem = clockItem; clockItem.IsSelected = true; this.SelectedTime = TimeSpan.Parse(clockItem.DataContext.ToString()); } }
internal void ProcessItem(int itemIndex) { RadClockItem selectedItem = this.ItemContainerGenerator.ContainerFromIndex(itemIndex) as RadClockItem; this.SelectItem(selectedItem); }