In This Article

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 a new instance of the BarComboBox class.

public BarComboBox()

Properties

CanStopPreviewingOnMouseLeave

Gets whether the gallery can stop previewing when the mouse leaves the control.

protected override bool CanStopPreviewingOnMouseLeave { get; }

Property Value

bool:

true if the gallery can stop previewing when the mouse leaves the control; otherwise, false.

CornerRadius

Gets or sets the corner radius of the control's border.

public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius:

The corner radius of the control's border.

HasDropShadow

Gets or sets whether the popup has a drop shadow.

public bool HasDropShadow { get; set; }

Property Value

bool:

true if the popup has a drop shadow; otherwise, false. The default value is true.

HasLabel

Gets whether the control has a Label available.

public bool HasLabel { get; }

Property Value

bool:

true if the control has a Label available; otherwise, false. The default value is false.

InlineImageSource

Gets the image source for the selected item to display in the combobox, set via the InlineImageSourcePath property.

public ImageSource InlineImageSource { get; }

Property Value

ImageSource:

The image source for the selected item to display in the combobox.

InlineImageSourcePath

Gets or sets the path to an ImageSource gallery item property, corresponding to optional inline image display.

[Localizability(LocalizationCategory.NeverLocalize)]
public string InlineImageSourcePath { get; set; }

Property Value

string:

The path to an ImageSource gallery item property, corresponding to optional inline image display.

IsEditable

Gets or sets whether the combobox is editable.

public bool IsEditable { get; set; }

Property Value

bool:

true if the combobox is editable; otherwise, false. The default value is false.

IsPopupOpen

Gets or sets whether the popup is currently open.

public bool IsPopupOpen { get; set; }

Property Value

bool:

true if the popup is currently open; otherwise, false. The default value is false.

IsPreviewEnabledWhenPopupClosed

Gets or sets 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:

true if 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 is false.

IsReadOnly

Gets or sets whether the combobox is read-only.

public bool IsReadOnly { get; set; }

Property Value

bool:

true if the combobox is read-only; otherwise, false. The default value is false.

IsStarSizingAllowed

Gets or sets whether the control can star-size and fill available space when appropriate.

public bool IsStarSizingAllowed { get; set; }

Property Value

bool:

true if the control can star-size; otherwise, false. The default value is false.

IsTextCompletionEnabled

Gets or sets whether the control will attempt to complete typed text with a matching item.

public bool IsTextCompletionEnabled { get; set; }

Property Value

bool:

true if the control will attempt to complete typed text with a matching item; otherwise, false. The default value is true.

IsUnmatchedTextAllowed

Gets or sets 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:

true if 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 is true.

See Also

KeyTipText

Gets or sets the key tip text used to access the control.

[Localizability(LocalizationCategory.Label)]
public string KeyTipText { get; set; }

Property Value

string:

The key tip text used to access the control.

MaxPopupHeight

Gets or sets the maximum popup height.

public double MaxPopupHeight { get; set; }

Property Value

double:

The maximum popup height. The default value is Double.PositiveInfinity.

PlaceholderText

Gets or sets the placeholder text to display when the control is empty.

[Localizability(LocalizationCategory.Text)]
public string PlaceholderText { get; set; }

Property Value

string:

The placeholder text to display when the control is empty.

PopupAnimation

Gets or sets the PopupAnimation to use in the popup.

public PopupAnimation PopupAnimation { get; set; }

Property Value

PopupAnimation:

The PopupAnimation to use in the popup.

PopupBackground

Gets or sets the Brush for the popup's background.

public Brush PopupBackground { get; set; }

Property Value

Brush:

The Brush for the popup's background.

PopupBorderBrush

Gets or sets the Brush for the popup's border.

public Brush PopupBorderBrush { get; set; }

Property Value

Brush:

The Brush for the popup's border.

PopupBorderThickness

Gets or sets the Thickness of the popup's border.

public Thickness PopupBorderThickness { get; set; }

Property Value

Thickness:

The Thickness of the popup's border.

PopupCornerRadius

Gets or sets the CornerRadius of the popup's border.

public CornerRadius PopupCornerRadius { get; set; }

Property Value

CornerRadius:

The CornerRadius of the popup's border.

PopupHorizontalOffset

Gets or sets the horizontal offset of the popup.

public double PopupHorizontalOffset { get; set; }

Property Value

double:

The horizontal offset of the popup.

PopupIndicatorTemplate

Gets or sets the DataTemplate for the popup indicator.

public DataTemplate PopupIndicatorTemplate { get; set; }

Property Value

DataTemplate:

The DataTemplate for the popup indicator.

PopupPadding

Gets or sets the Thickness of the popup's padding.

public Thickness PopupPadding { get; set; }

Property Value

Thickness:

The Thickness of the popup's padding.

PopupVerticalOffset

Gets or sets the vertical offset of the popup.

public double PopupVerticalOffset { get; set; }

Property Value

double:

The vertical offset of the popup.

RequestedWidth

Gets or sets 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

Gets or sets the screen tip footer content.

public object ScreenTipFooter { get; set; }

Property Value

object:

The screen tip footer content.

ScreenTipHeader

Gets or sets the screen tip header content.

public object ScreenTipHeader { get; set; }

Property Value

object:

The screen tip header content.

Text

Gets or sets the text to display in the control.

[Localizability(LocalizationCategory.Text)]
public string Text { get; set; }

Property Value

string:

The text to display in the control.

TextPath

Gets or sets the path to a string gallery item property, corresponding to Text display and entry.

[Localizability(LocalizationCategory.NeverLocalize)]
public string TextPath { get; set; }

Property Value

string:

The path to a string gallery item property, corresponding to Text display and entry.

ToolBarItemCollapseBehavior

Gets or sets 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

Gets or sets 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

Gets or sets 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

Gets or sets the VariantSize currently assigned to the control. This property should only be manually set when the control is standalone, and not hosted by a bar control.

public VariantSize VariantSize { get; set; }

Property Value

VariantSize:

The VariantSize currently assigned to the 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.

OnPopupClosed(RoutedEventArgs)

Occurs when the IsPopupOpen property changes to false.

protected virtual void OnPopupClosed(RoutedEventArgs e)
Parameter Type Description
e RoutedEventArgs

The RoutedEventArgs that contains 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 RoutedEventArgs that contains 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 CancelRoutedEventArgs that contains 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 PropertyChangedEventArgs that contains 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 RoutedEventArgs that contains 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.

public event RoutedEventHandler PopupClosed

Event Type

RoutedEventHandler

PopupOpened

Occurs when the IsPopupOpen property changes to true.

public event RoutedEventHandler PopupOpened

Event Type

RoutedEventHandler

PopupOpening

Occurs before the IsPopupOpen property changes to true.

public event EventHandler<CancelRoutedEventArgs> PopupOpening

Event Type

EventHandler<CancelRoutedEventArgs>

TextCommitted

Occurs after text is successfully committed, such as by pressing Enter.

public event RoutedEventHandler TextCommitted

Event Type

RoutedEventHandler

Fields

CornerRadiusProperty

Identifies the CornerRadius dependency property. This field is read-only.

public static readonly DependencyProperty CornerRadiusProperty

HasDropShadowProperty

Identifies the HasDropShadow dependency property. This field is read-only.

public static readonly DependencyProperty HasDropShadowProperty

HasLabelProperty

Identifies the HasLabel dependency property. This field is read-only.

public static readonly DependencyProperty HasLabelProperty

InlineImageSourcePathProperty

Identifies the InlineImageSourcePath dependency property. This field is read-only.

public static readonly DependencyProperty InlineImageSourcePathProperty

InlineImageSourceProperty

Identifies the InlineImageSource dependency property. This field is read-only.

public static readonly DependencyProperty InlineImageSourceProperty

IsEditableProperty

Identifies the IsEditable dependency property. This field is read-only.

public static readonly DependencyProperty IsEditableProperty

IsPopupOpenProperty

Identifies the IsPopupOpen dependency property. This field is read-only.

public static readonly DependencyProperty IsPopupOpenProperty

IsPreviewEnabledWhenPopupClosedProperty

Identifies the IsPreviewEnabledWhenPopupClosed dependency property. This field is read-only.

public static readonly DependencyProperty IsPreviewEnabledWhenPopupClosedProperty

IsReadOnlyProperty

Identifies the IsReadOnly dependency property. This field is read-only.

public static readonly DependencyProperty IsReadOnlyProperty

IsStarSizingAllowedProperty

Identifies the IsStarSizingAllowed dependency property. This field is read-only.

public static readonly DependencyProperty IsStarSizingAllowedProperty

IsTextCompletionEnabledProperty

Identifies the IsTextCompletionEnabled dependency property. This field is read-only.

public static readonly DependencyProperty IsTextCompletionEnabledProperty

IsUnmatchedTextAllowedProperty

Identifies the IsUnmatchedTextAllowed dependency property. This field is read-only.

public static readonly DependencyProperty IsUnmatchedTextAllowedProperty

KeyTipTextProperty

Identifies the KeyTipText dependency property. This field is read-only.

public static readonly DependencyProperty KeyTipTextProperty

MaxPopupHeightProperty

Identifies the MaxPopupHeight dependency property. This field is read-only.

public static readonly DependencyProperty MaxPopupHeightProperty

PlaceholderTextProperty

Identifies the PlaceholderText dependency property. This field is read-only.

public static readonly DependencyProperty PlaceholderTextProperty

PopupAnimationProperty

Identifies the PopupAnimation dependency property. This field is read-only.

public static readonly DependencyProperty PopupAnimationProperty

PopupBackgroundProperty

Identifies the PopupBackground dependency property. This field is read-only.

public static readonly DependencyProperty PopupBackgroundProperty

PopupBorderBrushProperty

Identifies the PopupBorderBrush dependency property. This field is read-only.

public static readonly DependencyProperty PopupBorderBrushProperty

PopupBorderThicknessProperty

Identifies the PopupBorderThickness dependency property. This field is read-only.

public static readonly DependencyProperty PopupBorderThicknessProperty

PopupClosedEvent

Identifies the PopupClosed routed event. This field is read-only.

public static readonly RoutedEvent PopupClosedEvent

PopupCornerRadiusProperty

Identifies the PopupCornerRadius dependency property. This field is read-only.

public static readonly DependencyProperty PopupCornerRadiusProperty

PopupHorizontalOffsetProperty

Identifies the PopupHorizontalOffset dependency property. This field is read-only.

public static readonly DependencyProperty PopupHorizontalOffsetProperty

PopupIndicatorTemplateProperty

Identifies the PopupIndicatorTemplate dependency property. This field is read-only.

public static readonly DependencyProperty PopupIndicatorTemplateProperty

PopupOpenedEvent

Identifies the PopupOpened routed event. This field is read-only.

public static readonly RoutedEvent PopupOpenedEvent

PopupOpeningEvent

Identifies the PopupOpening routed event. This field is read-only.

public static readonly RoutedEvent PopupOpeningEvent

PopupPaddingProperty

Identifies the PopupPadding dependency property. This field is read-only.

public static readonly DependencyProperty PopupPaddingProperty

PopupVerticalOffsetProperty

Identifies the PopupVerticalOffset dependency property. This field is read-only.

public static readonly DependencyProperty PopupVerticalOffsetProperty

RequestedWidthProperty

Identifies the RequestedWidth dependency property. This field is read-only.

public static readonly DependencyProperty RequestedWidthProperty

ScreenTipFooterProperty

Identifies the ScreenTipFooter dependency property. This field is read-only.

public static readonly DependencyProperty ScreenTipFooterProperty

ScreenTipHeaderProperty

Identifies the ScreenTipHeader dependency property. This field is read-only.

public static readonly DependencyProperty ScreenTipHeaderProperty

TextCommittedEvent

Identifies the TextCommitted routed event. This field is read-only.

public static readonly RoutedEvent TextCommittedEvent

TextPathProperty

Identifies the TextPath dependency property. This field is read-only.

public static readonly DependencyProperty TextPathProperty

TextProperty

Identifies the Text dependency property. This field is read-only.

public static readonly DependencyProperty TextProperty

ToolBarItemCollapseBehaviorProperty

Identifies the ToolBarItemCollapseBehavior dependency property. This field is read-only.

public static readonly DependencyProperty ToolBarItemCollapseBehaviorProperty

ToolBarItemVariantBehaviorProperty

Identifies the ToolBarItemVariantBehavior dependency property. This field is read-only.

public static readonly DependencyProperty ToolBarItemVariantBehaviorProperty

UnmatchedTextCommandProperty

Identifies the UnmatchedTextCommand dependency property. This field is read-only.

public static readonly DependencyProperty UnmatchedTextCommandProperty

VariantSizeProperty

Identifies the VariantSize dependency property. This field is read-only.

public static readonly DependencyProperty VariantSizeProperty

Inherited Members