ComboBoxBase Class
public abstract class ComboBoxBase : ComboBox, IKeyTipTarget, IVariantControl
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl Selector ComboBox object
- Derived:
- ComboBox
- Implements:
- IKeyTipTarget IVariantControl
Constructors
ComboBoxBase()
Initializes an instance of the ComboBoxBase
class.
protected ComboBoxBase()
Properties
CanUpdateCanExecuteWhenHidden
Gets whether the control gets its UpdateCanExecute() method called even when it is hidden.
protected virtual bool CanUpdateCanExecuteWhenHidden { get; }
Property Value
- bool:
true
if the control gets its UpdateCanExecute() method called even when it is hidden; otherwise,false
.
Command
Gets or sets the ICommand that is attached to the control.
public ICommand Command { get; set; }
Property Value
CommandParameter
Gets or sets a user defined data value that can be passed to the Command when it is executed.
public object CommandParameter { get; set; }
Property Value
CommandTarget
Gets or sets the object that the command is being executed on.
public IInputElement CommandTarget { get; set; }
Property Value
- IInputElement:
The object that the command is being executed on.
Context
Gets or sets a ControlContext that describes the current context of the control.
public ControlContext Context { get; set; }
Property Value
- ControlContext:
A ControlContext that describes the current context of the control.
HasImage
Gets whether the control has an image available for display.
public bool HasImage { get; }
Property Value
- bool:
true
if the control has an image available for display; otherwise,false
.
HasLabel
Gets whether the control has a label available for display.
public bool HasLabel { get; }
Property Value
- bool:
true
if the control has a label available for display; otherwise,false
.
Hint
Gets or sets the hint to display when the combobox is empty.
[Localizability(LocalizationCategory.Label)]
public object Hint { get; set; }
Property Value
- object:
The hint to display when the combobox is empty.
HintTemplate
Gets or sets a data template used to display the hint of the combobox.
public DataTemplate HintTemplate { get; set; }
Property Value
- DataTemplate:
A data template used to display the hint of the combobox.
HintTemplateSelector
Gets or sets a data template selector that enables an application writer to provide custom template-selection logic for the hint.
public DataTemplateSelector HintTemplateSelector { get; set; }
Property Value
- DataTemplateSelector:
A data template selector that enables an application writer to provide custom template-selection logic for the hint.
Id
Gets or sets the control ID, which can be used to identify the control.
[Localizability(LocalizationCategory.NeverLocalize)]
public string Id { get; set; }
Property Value
- string:
The control ID, which can be used to identify the control.
Remarks
When two controls of the same type have the same ID, they are considered the same for Quick Access ToolBar (QAT) customization purposes.
ImageSourceLarge
Gets or sets the ImageSource for the 32x32 image to display for the control.
public ImageSource ImageSourceLarge { get; set; }
Property Value
- ImageSource:
The ImageSource for the 32x32 image to display for the control.
ImageSourceSmall
Gets or sets the ImageSource for the 16x16 image to display for the control.
public ImageSource ImageSourceSmall { get; set; }
Property Value
- ImageSource:
The ImageSource for the 16x16 image to display for the control.
IsHighlighted
Gets or sets whether the control is currently highlighted in a menu.
public bool IsHighlighted { get; set; }
Property Value
- bool:
true
if the control is currently highlighted in a menu; otherwise,false
.
IsPointerOver
Gets whether the mouse is truly over the control, which works around an issue in WPF where taps on controls retain the mouse over state.
public bool IsPointerOver { get; }
Property Value
- bool:
true
if the mouse is truly over the control; otherwise,false
.
KeyTipAccessText
Gets or sets the key tip access text for the control.
[Localizability(LocalizationCategory.Text)]
public string KeyTipAccessText { get; set; }
Property Value
- string:
The key tip access text for the control.
Label
Gets or sets the text label to display for the control.
[Localizability(LocalizationCategory.Label)]
public string Label { get; set; }
Property Value
- string:
The text label to display for the control.
ScreenTipDescription
Gets or sets the description object that will be displayed in screen tips for the control.
[Localizability(LocalizationCategory.ToolTip)]
public object ScreenTipDescription { get; set; }
Property Value
- object:
The description object that will be displayed in screen tips for the control.
ScreenTipFooter
Gets or sets the footer object that will be displayed in screen tips for the control.
[Localizability(LocalizationCategory.ToolTip)]
public object ScreenTipFooter { get; set; }
Property Value
- object:
The footer object that will be displayed in screen tips for the control.
ScreenTipHeader
Gets or sets the header object that will be displayed in screen tips for the control.
[Localizability(LocalizationCategory.ToolTip)]
public object ScreenTipHeader { get; set; }
Property Value
- object:
The header object that will be displayed in screen tips for the control.
ScreenTipHelpUri
Gets or sets the System.Uri specifying the location of context-sensitive help related to the control when its screen tip is displayed and F1
is pressed.
public Uri ScreenTipHelpUri { get; set; }
Property Value
- Uri:
The System.Uri specifying the location of context-sensitive help related to the control when its screen tip is displayed and
F1
is pressed.
ScreenTipImageSource
Gets or sets the ImageSource for the image that will be displayed in screen tips for the control.
public ImageSource ScreenTipImageSource { get; set; }
Property Value
- ImageSource:
The ImageSource for the image that will be displayed in screen tips for the control.
VariantSize
Gets or sets a VariantSize that indicates the control's current variant size.
public VariantSize VariantSize { get; set; }
Property Value
- VariantSize:
A VariantSize that indicates the control's current variant size. The default value is
VariantSize.Medium
.
Methods
CoerceCommandParameter(DependencyObject, object)
Coerces a new CommandParameterProperty value.
protected virtual object CoerceCommandParameter(DependencyObject obj, object value)
Parameter | Type | Description |
---|---|---|
obj | DependencyObject | The System.Windows.DependencyObject whose property is changed. |
value | object | The new value being set. |
Returns
- object:
The coerced value to set.
OnClick(ExecuteRoutedEventArgs)
Called when the control is clicked and a Click event is raised.
protected virtual void OnClick(ExecuteRoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | ExecuteRoutedEventArgs | An |
OnCommandChanged(ICommand, ICommand)
Occurs when the Command property is changed.
protected virtual void OnCommandChanged(ICommand oldCommand, ICommand newCommand)
Parameter | Type | Description |
---|---|---|
oldCommand | ICommand | The old ICommand value. |
newCommand | ICommand | The new ICommand value. |
OnContextChanged(ControlContext, ControlContext)
Occurs when the Context property is changed.
protected virtual void OnContextChanged(ControlContext oldContext, ControlContext newContext)
Parameter | Type | Description |
---|---|---|
oldContext | ControlContext | The old ControlContext value. |
newContext | ControlContext | The new ControlContext value. |
OnCreateAutomationPeer()
Creates and returns an AutomationPeer object for this type.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
The AutomationPeer that was created.
OnItemsChanged(NotifyCollectionChangedEventArgs)
Invoked when the Items
property changes.
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | NotifyCollectionChangedEventArgs | A NotifyCollectionChangedEventArgs that contains the event data. |
OnKeyTipAccessed(string)
Called when key tip access text for the control is typed by the end user.
protected virtual bool OnKeyTipAccessed(string keyTipAccessText)
Parameter | Type | Description |
---|---|---|
keyTipAccessText | string | The key tip access text that was typed. |
Returns
- bool:
true
if an action was executed that should stop key tip mode; otherwise,false
.
Remarks
Implementations of this method should either execute the action associated with the control or move focus to the control so that the end user can take further action such as in a menu.
OnMouseEnter(MouseEventArgs)
Occurs when the mouse enters the control.
protected override void OnMouseEnter(MouseEventArgs e)
Parameter | Type | Description |
---|---|---|
e | MouseEventArgs | A MouseEventArgs that contains the event data. |
OnMouseLeave(MouseEventArgs)
Occurs when the mouse leaves the control.
protected override void OnMouseLeave(MouseEventArgs e)
Parameter | Type | Description |
---|---|---|
e | MouseEventArgs | A MouseEventArgs that contains the event data. |
OnPreviewClick(ExecuteRoutedEventArgs)
Raises the PreviewClick event.
protected virtual void OnPreviewClick(ExecuteRoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | ExecuteRoutedEventArgs | An |
OnPropertyChanged(DependencyPropertyChangedEventArgs)
Occurs when a property is changed.
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | DependencyPropertyChangedEventArgs | A System.Windows.DependencyPropertyChangedEventArgs that contains the event data. |
OnScreenTipClosing(RoutedEventArgs)
Invoked when an unhandled ScreenTipClosing 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 virtual void OnScreenTipClosing(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | A |
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.
OnScreenTipOpening(RoutedEventArgs)
Invoked when an unhandled ScreenTipOpening 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 virtual void OnScreenTipOpening(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | A |
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.
OnTouchLeave(TouchEventArgs)
Occurs when the touch device leaves the control.
protected override void OnTouchLeave(TouchEventArgs e)
Parameter | Type | Description |
---|---|---|
e | TouchEventArgs | A TouchEventArgs that contains the event data. |
OnValidateItems(IList)
Invoked when the specified IList of items needs to be validated for inclusion in this ItemsControl.
protected virtual void OnValidateItems(IList items)
Parameter | Type | Description |
---|---|---|
items | IList | The IList of items to validate. |
OnVariantSizeChanged(VariantSize, VariantSize)
Occurs when the VariantSize property is changed.
protected virtual void OnVariantSizeChanged(VariantSize oldVariantSize, VariantSize newVariantSize)
Parameter | Type | Description |
---|---|---|
oldVariantSize | VariantSize | The old VariantSize value. |
newVariantSize | VariantSize | The new VariantSize value. |
RaiseClickEvent(ExecuteRoutedEventArgs)
Called when the control is clicked to raise a Click event.
public void RaiseClickEvent(ExecuteRoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | ExecuteRoutedEventArgs | An |
SetText(string)
Sets the Text
property and can optionally perform other operations.
protected virtual void SetText(string text)
Parameter | Type | Description |
---|---|---|
text | string | The text. |
UpdateCanExecute()
Updates whether the command can execute.
protected virtual void UpdateCanExecute()
Events
Click
Occurs after a click event occurs on the control.
public event EventHandler<ExecuteRoutedEventArgs> Click
Event Type
PreviewClick
Occurs when a click event is about to occur on the control, thereby causing any containing menus to close.
public event EventHandler<ExecuteRoutedEventArgs> PreviewClick
Event Type
ScreenTipClosing
Occurs before any screen tip on the control is closed.
ScreenTipOpening
Occurs before any screen tip on the control is opened.
Fields
ClickEvent
Identifies the Click routed event. This field is read-only.
public static readonly RoutedEvent ClickEvent
CommandParameterProperty
Identifies the CommandParameter dependency property. This field is read-only.
public static readonly DependencyProperty CommandParameterProperty
CommandProperty
Identifies the Command dependency property. This field is read-only.
public static readonly DependencyProperty CommandProperty
CommandTargetProperty
Identifies the CommandTarget dependency property. This field is read-only.
public static readonly DependencyProperty CommandTargetProperty
ContextProperty
Identifies the Context dependency property. This field is read-only.
public static readonly DependencyProperty ContextProperty
HasImageProperty
Identifies the HasImage dependency property. This field is read-only.
public static readonly DependencyProperty HasImageProperty
HasLabelProperty
Identifies the HasLabel dependency property. This field is read-only.
public static readonly DependencyProperty HasLabelProperty
HintProperty
Identifies the Hint dependency property. This field is read-only.
public static readonly DependencyProperty HintProperty
HintTemplateProperty
Identifies the HintTemplate dependency property. This field is read-only.
public static readonly DependencyProperty HintTemplateProperty
HintTemplateSelectorProperty
Identifies the HintTemplateSelector dependency property. This field is read-only.
public static readonly DependencyProperty HintTemplateSelectorProperty
IdProperty
Identifies the Id dependency property. This field is read-only.
public static readonly DependencyProperty IdProperty
ImageSourceLargeProperty
Identifies the ImageSourceLarge dependency property. This field is read-only.
public static readonly DependencyProperty ImageSourceLargeProperty
ImageSourceSmallProperty
Identifies the ImageSourceSmall dependency property. This field is read-only.
public static readonly DependencyProperty ImageSourceSmallProperty
IsHighlightedProperty
Identifies the IsHighlighted dependency property. This field is read-only.
public static readonly DependencyProperty IsHighlightedProperty
IsPointerOverProperty
Identifies the IsPointerOver dependency property. This field is read-only.
public static readonly DependencyProperty IsPointerOverProperty
KeyTipAccessTextProperty
Identifies the KeyTipAccessText dependency property. This field is read-only.
public static readonly DependencyProperty KeyTipAccessTextProperty
LabelProperty
Identifies the Label dependency property. This field is read-only.
public static readonly DependencyProperty LabelProperty
PreviewClickEvent
Identifies the PreviewClick routed event. This field is read-only.
public static readonly RoutedEvent PreviewClickEvent
ScreenTipClosingEvent
Identifies the ScreenTipClosing routed event. This field is read-only.
public static readonly RoutedEvent ScreenTipClosingEvent
ScreenTipDescriptionProperty
Identifies the ScreenTipDescription dependency property. This field is read-only.
public static readonly DependencyProperty ScreenTipDescriptionProperty
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
ScreenTipHelpUriProperty
Identifies the ScreenTipHelpUri dependency property. This field is read-only.
public static readonly DependencyProperty ScreenTipHelpUriProperty
ScreenTipImageSourceProperty
Identifies the ScreenTipImageSource dependency property. This field is read-only.
public static readonly DependencyProperty ScreenTipImageSourceProperty
ScreenTipOpeningEvent
Identifies the ScreenTipOpening routed event. This field is read-only.
public static readonly RoutedEvent ScreenTipOpeningEvent
VariantSizeProperty
Identifies the VariantSize dependency property. This field is read-only.
public static readonly DependencyProperty VariantSizeProperty