static AutoFilteredComboBox() { IsTextSearchEnabledProperty.OverrideMetadata(typeof(AutoFilteredComboBox), new FrameworkPropertyMetadata(true)); IsEditableProperty.OverrideMetadata(typeof(AutoFilteredComboBox), new FrameworkPropertyMetadata(true)); DisplayMemberPathProperty.OverrideMetadata(typeof(AutoFilteredComboBox), new FrameworkPropertyMetadata(null, DisplayMemberPathChanged)); }
/// <summary> /// Initializes static members of the <see cref="ComboBox"/> class. /// </summary> static ComboBox() { ItemsPanelProperty.OverrideDefaultValue <ComboBox>(DefaultPanel); FocusableProperty.OverrideDefaultValue <ComboBox>(true); SelectedItemProperty.Changed.AddClassHandler <ComboBox>((x, e) => x.SelectedItemChanged(e)); KeyDownEvent.AddClassHandler <ComboBox>((x, e) => x.OnKeyDown(e), Interactivity.RoutingStrategies.Tunnel); IsTextSearchEnabledProperty.OverrideDefaultValue <ComboBox>(true); }
static ListBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(typeof(ListBox))); _dType = DependencyObjectType.FromSystemTypeInternal(typeof(ListBox)); IsTabStopProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox)); KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.Contained)); KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once)); IsTextSearchEnabledProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox)); ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(VirtualizingStackPanel))); template.Seal(); ItemsPanelProperty.OverrideMetadata(typeof(ListBox), new FrameworkPropertyMetadata(template)); // Need handled events too here because any mouse up should release our mouse capture EventManager.RegisterClassHandler(typeof(ListBox), Mouse.MouseUpEvent, new MouseButtonEventHandler(OnMouseButtonUp), true); EventManager.RegisterClassHandler(typeof(ListBox), Keyboard.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(OnGotKeyboardFocus)); CommandHelpers.RegisterCommandHandler(typeof(ListBox), ListBox.SelectAllCommand, new ExecutedRoutedEventHandler(OnSelectAll), new CanExecuteRoutedEventHandler(OnQueryStatusSelectAll), KeyGesture.CreateFromResourceStrings(SR.Get(SRID.ListBoxSelectAllKey), SR.Get(SRID.ListBoxSelectAllKeyDisplayString))); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors /// <summary> /// Static ZoomComboBox constructor /// </summary> static ZoomComboBox() { // Override this ComboBox property so that any zoom values that are found in the TextBox // (either from user input, or databinding) are not looked up in the drop down list. IsTextSearchEnabledProperty.OverrideMetadata(typeof(ZoomComboBox), new FrameworkPropertyMetadata(false)); }