protected override DependencyObject GetContainerForItemOverride() { var comboBoxItem = new ComboBoxItemEx(); RegisterEventHandlerForWhenIsHighlightedChanges(comboBoxItem); return(comboBoxItem); }
private void RemoveHighlightFromCurrentlyHighlightedItem() { if (HighlightedItem != null) { ComboBoxItemEx highlightedComboBoxItem = GetHighlightedComboBoxItem(); highlightedComboBoxItem.IsHighlighted = false; } }
private void GetComboBoxNullItemFromTemplate() { _comboBoxNullItem = GetTemplateChild("PART_NullValue") as ComboBoxItemEx; }
private void OnComboBoxItemHighlighted(ComboBoxItemEx comboBoxItem) { HighlightedItem = comboBoxItem.DataContext; RemoveHighlightFromComboBoxNullItem(); }
private void RegisterEventHandlerForWhenIsHighlightedChanges(ComboBoxItemEx comboBoxItem) { DependencyPropertyDescriptor.FromProperty(ComboBoxItem.IsHighlightedProperty, typeof(ComboBoxItemEx)). AddValueChanged(comboBoxItem, (o, e) => OnComboBoxItemHighlighted(o as ComboBoxItemEx)); }