BarComboBox Class
Represents a combobox control, for use within a ribbon or toolbar.
[TemplatePart(Name = "PART_DropDownButton", Type = typeof(BarComboBoxDropDownButton))]
[TemplatePart(Name = "PART_TextBox", Type = typeof(TextBox))]
public class BarComboBox : BarMenuGalleryHostBase, ISupportsStarSizing
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl Selector BarGalleryBase BarMenuGalleryHostBase object
- Implements:
- ISupportsStarSizing
Constructors
BarComboBox()
Initializes an instance of the class.
public BarComboBox()
Properties
CanStopPreviewingOnMouseLeave
Indicates whether the gallery can stop previewing when the mouse leaves the control.
protected override bool CanStopPreviewingOnMouseLeave { get; }
Property Value
- bool:
trueif the gallery can stop previewing when the mouse leaves the control; otherwise,false.
CornerRadius
The corner radius of the control's border.
HasDropShadow
Indicates whether the popup has a drop shadow.
public bool HasDropShadow { get; set; }
Property Value
- bool:
trueif the popup has a drop shadow; otherwise,false. The default value istrue.
HasLabel
Indicates whether the control has a Label available.
public bool HasLabel { get; }
Property Value
InlineImageSource
The image source for the selected item to display in the combobox, set via the InlineImageSourcePath property.
InlineImageSourcePath
The path to an ImageSource gallery item property, corresponding to optional inline image display.
[Localizability(LocalizationCategory.NeverLocalize)]
public string? InlineImageSourcePath { get; set; }
Property Value
IsEditable
Indicates whether the combobox is editable.
public bool IsEditable { get; set; }
Property Value
- bool:
trueif the combobox is editable; otherwise,false. The default value isfalse.
IsPopupOpen
Indicates whether the popup is currently open.
public bool IsPopupOpen { get; set; }
Property Value
- bool:
trueif the popup is currently open; otherwise,false. The default value isfalse.
IsPreviewEnabledWhenPopupClosed
Indicates whether an editable combobox will preview a gallery item if the item is matched by typed text while the popup is closed.
public bool IsPreviewEnabledWhenPopupClosed { get; set; }
Property Value
- bool:
trueif an editable combobox will preview a gallery item if the item is matched by typed text while the popup is closed; otherwise,false. The default value isfalse.
IsReadOnly
Indicates whether the combobox is read-only.
public bool IsReadOnly { get; set; }
Property Value
- bool:
trueif the combobox is read-only; otherwise,false. The default value isfalse.
IsStarSizingAllowed
Indicates whether the control can star-size and fill available space when appropriate.
public bool IsStarSizingAllowed { get; set; }
Property Value
- bool:
trueif star-sizing is allowed; otherwise,false. The default value isfalse.
IsTextCompletionEnabled
Indicates whether the control will attempt to complete typed text with a matching item.
public bool IsTextCompletionEnabled { get; set; }
Property Value
- bool:
trueif the control will attempt to complete typed text with a matching item; otherwise,false. The default value istrue.
IsUnmatchedTextAllowed
Indicates whether committed Text that is unable to be matched to a gallery item will raise the UnmatchedTextCommand and possibly be allowed.
public bool IsUnmatchedTextAllowed { get; set; }
Property Value
- bool:
trueif committed Text that is unable to be matched to a gallery item will raise the UnmatchedTextCommand and possibly be allowed; otherwise,false. The default value istrue.
See Also
KeyTipText
The key tip text used to access the control.
[Localizability(LocalizationCategory.Label)]
public string? KeyTipText { get; set; }
Property Value
MaxPopupHeight
The maximum popup height.
public double MaxPopupHeight { get; set; }
Property Value
- double:
The maximum popup height. The default value is
Double.PositiveInfinity.
PlaceholderText
The placeholder text to display when the control is empty.
[Localizability(LocalizationCategory.Text)]
public string? PlaceholderText { get; set; }
Property Value
PopupAnimation
The PopupAnimation to use in the popup.
PopupBackground
The Brush for the popup's background.
PopupBorderBrush
The Brush for the popup's border.
PopupBorderThickness
The Thickness of the popup's border.
PopupCornerRadius
The CornerRadius of the popup's border.
PopupHorizontalOffset
The horizontal offset of the popup.
PopupIndicatorTemplate
The DataTemplate for the popup indicator.
PopupPadding
The Thickness of the popup's padding.
PopupVerticalOffset
The vertical offset of the popup.
RequestedWidth
The requested width of the control.
public double RequestedWidth { get; set; }
Property Value
- double:
The requested width of the control. The default value is
110.
ScreenTipFooter
The screen tip footer content.
ScreenTipHeader
The screen tip header content.
Text
The text to display in the control.
TextPath
The path to a string gallery item property, corresponding to Text display and entry.
[Localizability(LocalizationCategory.NeverLocalize)]
public string? TextPath { get; set; }
Property Value
ToolBarItemCollapseBehavior
The ItemCollapseBehavior for the control when in a ribbon using Simplified layout mode.
public ItemCollapseBehavior ToolBarItemCollapseBehavior { get; set; }
Property Value
- ItemCollapseBehavior:
The ItemCollapseBehavior for the control when in a ribbon using Simplified layout mode. The default value is
Default.
ToolBarItemVariantBehavior
The ItemVariantBehavior for the control when in a toolbar, which also applies when in a ribbon using Simplified layout mode.
public ItemVariantBehavior ToolBarItemVariantBehavior { get; set; }
Property Value
- ItemVariantBehavior:
The ItemVariantBehavior for the control when in a toolbar, which also applies when in a ribbon using Simplified layout mode. The default value is
AlwaysSmall.
UnmatchedTextCommand
The ICommand to execute when Text is committed that is unable to be matched to a gallery item
or when IsTextSearchEnabled is false.
public ICommand? UnmatchedTextCommand { get; set; }
Property Value
- ICommand:
The ICommand to execute when Text is committed that is unable to be matched to a gallery item or when IsTextSearchEnabled is
false.
Remarks
This command is only used when the IsUnmatchedTextAllowed property is true.
The unmatched text string is passed as a command parameter.
When the command is null or CanExecute(object) returns true, the text will be committed; otherwise, it will not be committed.
See Also
VariantSize
The VariantSize currently assigned to the control.
public VariantSize VariantSize { get; set; }
Property Value
Remarks
This property should only be manually set when the control is standalone, and not hosted by a bar control.
Methods
MeasureOverride(Size)
Called to remeasure a control.
protected override Size MeasureOverride(Size constraint)
| Parameter | Type | Description |
|---|---|---|
| constraint | Size | The maximum size that the method can return. |
Returns
- Size:
The size of the control, up to the maximum specified by
constraint.
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnCreateAutomationPeer()
Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
The type-specific AutomationPeer implementation.
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.GotKeyboardFocus attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyboardFocusChangedEventArgs | The KeyboardFocusChangedEventArgs that contains the event data. |
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
Called when the IsKeyboardFocusWithin property has changed.
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | DependencyPropertyChangedEventArgs | The event data. |
OnKeyDown(KeyEventArgs)
Invoked when the KeyDown event is received.
protected override void OnKeyDown(KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyEventArgs | Information about the event. |
OnKeyTipInvoked(KeyTipInvokedEventArgs)
Occurs when the control's key tip is invoked.
protected virtual void OnKeyTipInvoked(KeyTipInvokedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyTipInvokedEventArgs | The KeyTipInvokedEventArgs containing data related to this event. |
OnKeyTipOpening(KeyTipOpeningEventArgs)
Occurs when the control's key tip is opening.
protected virtual void OnKeyTipOpening(KeyTipOpeningEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyTipOpeningEventArgs | The KeyTipOpeningEventArgs containing data related to this event. |
OnLostKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.LostKeyboardFocus attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyboardFocusChangedEventArgs | The KeyboardFocusChangedEventArgs that contains event data. |
OnPopupClosed(RoutedEventArgs)
Occurs when the IsPopupOpen property changes to false.
protected virtual void OnPopupClosed(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The event data. |
Remarks
This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.
OnPopupOpened(RoutedEventArgs)
Occurs when the IsPopupOpen property changes to true.
protected virtual void OnPopupOpened(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The event data. |
Remarks
This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.
OnPopupOpening(CancelRoutedEventArgs)
Occurs before the IsPopupOpen property changes to true.
protected virtual void OnPopupOpening(CancelRoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | CancelRoutedEventArgs | The event data. |
Remarks
This method has no default implementation. Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.
OnPreviewKeyDown(KeyEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.PreviewKeyDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPreviewKeyDown(KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyEventArgs | The KeyEventArgs that contains the event data. |
OnSelectedItemPropertyChanged(object?, PropertyChangedEventArgs)
Occurs when the value of a property on a currently selected item is changed.
protected virtual void OnSelectedItemPropertyChanged(object? sender, PropertyChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| sender | object | The sender of the event. |
| e | PropertyChangedEventArgs | The event data. |
OnSelectionChanged(SelectionChangedEventArgs)
Called when the selection changes.
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | SelectionChangedEventArgs | The event data. |
OnTextCommitted(RoutedEventArgs)
Occurs after text is successfully committed, such as by pressing Enter.
protected virtual void OnTextCommitted(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The event data. |
OnTextInput(TextCompositionEventArgs)
Invoked when the TextInput event is received.
protected override void OnTextInput(TextCompositionEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TextCompositionEventArgs | Information about the event. |
Events
PopupClosed
Occurs when the IsPopupOpen property changes to false.
PopupOpened
Occurs when the IsPopupOpen property changes to true.
PopupOpening
Occurs before the IsPopupOpen property changes to true.
public event EventHandler<CancelRoutedEventArgs> PopupOpening
Event Type
TextCommitted
Occurs after text is successfully committed, such as by pressing Enter.
Fields
CornerRadiusProperty
Defines the CornerRadius property.
public static readonly DependencyProperty CornerRadiusProperty
HasDropShadowProperty
Defines the HasDropShadow property.
public static readonly DependencyProperty HasDropShadowProperty
HasLabelProperty
Defines the HasLabel property.
public static readonly DependencyProperty HasLabelProperty
InlineImageSourcePathProperty
Defines the InlineImageSourcePath property.
public static readonly DependencyProperty InlineImageSourcePathProperty
InlineImageSourceProperty
Defines the InlineImageSource property.
public static readonly DependencyProperty InlineImageSourceProperty
IsEditableProperty
Defines the IsEditable property.
public static readonly DependencyProperty IsEditableProperty
IsPopupOpenProperty
Defines the IsPopupOpen property.
public static readonly DependencyProperty IsPopupOpenProperty
IsPreviewEnabledWhenPopupClosedProperty
Defines the IsPreviewEnabledWhenPopupClosed property.
public static readonly DependencyProperty IsPreviewEnabledWhenPopupClosedProperty
IsReadOnlyProperty
Defines the IsReadOnly property.
public static readonly DependencyProperty IsReadOnlyProperty
IsStarSizingAllowedProperty
Defines the IsStarSizingAllowed property.
public static readonly DependencyProperty IsStarSizingAllowedProperty
IsTextCompletionEnabledProperty
Defines the IsTextCompletionEnabled property.
public static readonly DependencyProperty IsTextCompletionEnabledProperty
IsUnmatchedTextAllowedProperty
Defines the IsUnmatchedTextAllowed property.
public static readonly DependencyProperty IsUnmatchedTextAllowedProperty
KeyTipTextProperty
Defines the KeyTipText property.
public static readonly DependencyProperty KeyTipTextProperty
MaxPopupHeightProperty
Defines the MaxPopupHeight property.
public static readonly DependencyProperty MaxPopupHeightProperty
PlaceholderTextProperty
Defines the PlaceholderText property.
public static readonly DependencyProperty PlaceholderTextProperty
PopupAnimationProperty
Defines the PopupAnimation property.
public static readonly DependencyProperty PopupAnimationProperty
PopupBackgroundProperty
Defines the PopupBackground property.
public static readonly DependencyProperty PopupBackgroundProperty
PopupBorderBrushProperty
Defines the PopupBorderBrush property.
public static readonly DependencyProperty PopupBorderBrushProperty
PopupBorderThicknessProperty
Defines the PopupBorderThickness property.
public static readonly DependencyProperty PopupBorderThicknessProperty
PopupClosedEvent
Defines the PopupClosed routed event.
public static readonly RoutedEvent PopupClosedEvent
PopupCornerRadiusProperty
Defines the PopupCornerRadius property.
public static readonly DependencyProperty PopupCornerRadiusProperty
PopupHorizontalOffsetProperty
Defines the PopupHorizontalOffset property.
public static readonly DependencyProperty PopupHorizontalOffsetProperty
PopupIndicatorTemplateProperty
Defines the PopupIndicatorTemplate property.
public static readonly DependencyProperty PopupIndicatorTemplateProperty
PopupOpenedEvent
Defines the PopupOpened routed event.
public static readonly RoutedEvent PopupOpenedEvent
PopupOpeningEvent
Defines the PopupOpening routed event.
public static readonly RoutedEvent PopupOpeningEvent
PopupPaddingProperty
Defines the PopupPadding property.
public static readonly DependencyProperty PopupPaddingProperty
PopupVerticalOffsetProperty
Defines the PopupVerticalOffset property.
public static readonly DependencyProperty PopupVerticalOffsetProperty
RequestedWidthProperty
Defines the RequestedWidth property.
public static readonly DependencyProperty RequestedWidthProperty
ScreenTipFooterProperty
Defines the ScreenTipFooter property.
public static readonly DependencyProperty ScreenTipFooterProperty
ScreenTipHeaderProperty
Defines the ScreenTipHeader property.
public static readonly DependencyProperty ScreenTipHeaderProperty
TextCommittedEvent
Defines the TextCommitted routed event.
public static readonly RoutedEvent TextCommittedEvent
TextPathProperty
Defines the TextPath property.
public static readonly DependencyProperty TextPathProperty
TextProperty
Defines the Text property.
public static readonly DependencyProperty TextProperty
ToolBarItemCollapseBehaviorProperty
Defines the ToolBarItemCollapseBehavior property.
public static readonly DependencyProperty ToolBarItemCollapseBehaviorProperty
ToolBarItemVariantBehaviorProperty
Defines the ToolBarItemVariantBehavior property.
public static readonly DependencyProperty ToolBarItemVariantBehaviorProperty
UnmatchedTextCommandProperty
Defines the UnmatchedTextCommand property.
public static readonly DependencyProperty UnmatchedTextCommandProperty
VariantSizeProperty
Defines the VariantSize property.
public static readonly DependencyProperty VariantSizeProperty
Inherited Members
- BarMenuGalleryHostBase.AboveMenuItemsProperty
- BarMenuGalleryHostBase.AreSurroundingSeparatorsAllowedOnMenuProperty
- BarMenuGalleryHostBase.BelowMenuItemsProperty
- BarMenuGalleryHostBase.CanCategorizeOnMenuProperty
- BarMenuGalleryHostBase.CanFilterOnMenuProperty
- BarMenuGalleryHostBase.CategoryHeaderTemplateProperty
- BarMenuGalleryHostBase.HasCategoryHeadersOnMenuProperty
- BarMenuGalleryHostBase.InvocationFocusBehaviorProperty
- BarMenuGalleryHostBase.MaxMenuColumnCountProperty
- BarMenuGalleryHostBase.MaxMenuGalleryHeightProperty
- BarMenuGalleryHostBase.MenuResizeModeProperty
- BarMenuGalleryHostBase.MinMenuColumnCountProperty
- BarMenuGalleryHostBase.PopupClosedCommandProperty
- BarMenuGalleryHostBase.PopupOpeningCommandProperty
- BarMenuGalleryHostBase.SelectedFilterCategoryProperty
- BarMenuGalleryHostBase.UseMenuItemAppearanceProperty
- BarMenuGalleryHostBase.UseMenuItemIndentProperty
- BarMenuGalleryHostBase.AboveMenuItems
- BarMenuGalleryHostBase.AreSurroundingSeparatorsAllowedOnMenu
- BarMenuGalleryHostBase.BelowMenuItems
- BarMenuGalleryHostBase.CanCategorizeOnMenu
- BarMenuGalleryHostBase.CanFilterOnMenu
- BarMenuGalleryHostBase.CategoryHeaderTemplate
- BarMenuGalleryHostBase.HasCategoryHeadersOnMenu
- BarMenuGalleryHostBase.InvocationFocusBehavior
- BarMenuGalleryHostBase.MaxMenuColumnCount
- BarMenuGalleryHostBase.MaxMenuGalleryHeight
- BarMenuGalleryHostBase.MenuResizeMode
- BarMenuGalleryHostBase.MinMenuColumnCount
- BarMenuGalleryHostBase.PopupClosedCommand
- BarMenuGalleryHostBase.PopupOpeningCommand
- BarMenuGalleryHostBase.SelectedFilterCategory
- BarMenuGalleryHostBase.UseMenuItemAppearance
- BarMenuGalleryHostBase.UseMenuItemIndent
- BarGalleryBase.HighlightedItemChangedEvent
- BarGalleryBase.BetweenPreviewDelayProperty
- BarGalleryBase.CanCloneToRibbonQuickAccessToolBarProperty
- BarGalleryBase.CommandProperty
- BarGalleryBase.CommandTargetProperty
- BarGalleryBase.HighlightedItemProperty
- BarGalleryBase.InitialPreviewDelayProperty
- BarGalleryBase.IsSelectionSupportedProperty
- BarGalleryBase.ItemSpacingProperty
- BarGalleryBase.KeyProperty
- BarGalleryBase.LabelProperty
- BarGalleryBase.LargeImageSourceProperty
- BarGalleryBase.MinItemHeightProperty
- BarGalleryBase.MinItemWidthProperty
- BarGalleryBase.MediumImageSourceProperty
- BarGalleryBase.PreviewedItemProperty
- BarGalleryBase.SmallImageSourceProperty
- BarGalleryBase.StaysOpenOnClickProperty
- BarGalleryBase.TitleProperty
- BarGalleryBase.UseAccentedItemBorderProperty
- BarGalleryBase.UserInterfaceDensityProperty
- BarGalleryBase.ClearContainerForItemOverride(DependencyObject, object)
- BarGalleryBase.GetContainerForItemOverride()
- BarGalleryBase.IsItemItsOwnContainerOverride(object)
- BarGalleryBase.OnHighlightedItemChanged(RoutedEventArgs)
- BarGalleryBase.OnItemSpacingPropertyValueChanged(DependencyPropertyChangedEventArgs)
- BarGalleryBase.OnMinItemHeightPropertyValueChanged(DependencyPropertyChangedEventArgs)
- BarGalleryBase.OnMinItemWidthPropertyValueChanged(DependencyPropertyChangedEventArgs)
- BarGalleryBase.OnMouseLeave(MouseEventArgs)
- BarGalleryBase.OnMouseMove(MouseEventArgs)
- BarGalleryBase.OnUserInterfaceDensityPropertyValueChanged(DependencyPropertyChangedEventArgs)
- BarGalleryBase.PrepareContainerForItemOverride(DependencyObject, object)
- BarGalleryBase.ScrollToSelectedItem(bool)
- BarGalleryBase.ToString()
- BarGalleryBase.BetweenPreviewDelay
- BarGalleryBase.CanCloneToRibbonQuickAccessToolBar
- BarGalleryBase.Command
- BarGalleryBase.CommandTarget
- BarGalleryBase.HighlightedItem
- BarGalleryBase.InitialPreviewDelay
- BarGalleryBase.IsSelectionSupported
- BarGalleryBase.ItemSpacing
- BarGalleryBase.Key
- BarGalleryBase.Label
- BarGalleryBase.LargeImageSource
- BarGalleryBase.MediumImageSource
- BarGalleryBase.MinItemHeight
- BarGalleryBase.MinItemWidth
- BarGalleryBase.PreviewedItem
- BarGalleryBase.SmallImageSource
- BarGalleryBase.StaysOpenOnClick
- BarGalleryBase.Title
- BarGalleryBase.UseAccentedItemBorder
- BarGalleryBase.UserInterfaceDensity
- BarGalleryBase.HighlightedItemChanged