BarTextBox Class
Represents a textbox control, for use within a ribbon or toolbar.
public class BarTextBox : TextBox, ISupportsStarSizing
- Inheritance:
- object Visual UIElement FrameworkElement Control TextBoxBase TextBox object
- Implements:
- ISupportsStarSizing
Constructors
BarTextBox()
Initializes an instance of the class.
public BarTextBox()
Properties
CanCloneToRibbonQuickAccessToolBar
Indicates whether the control can be cloned to the ribbon quick-access toolbar.
public bool CanCloneToRibbonQuickAccessToolBar { get; set; }
Property Value
- bool:
trueif the control can be cloned to the ribbon quick-access toolbar; otherwise,false. The default value istrue.
Command
The ICommand to execute when text is committed.
CommandParameter
The parameter for the Command.
CommandTarget
The IInputElement target for the Command.
InvocationFocusBehavior
Indicates how the control processes focus when a commit occurs.
public InvocationFocusBehavior InvocationFocusBehavior { get; set; }
Property Value
- InvocationFocusBehavior:
The default value is Default.
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.
Key
A string that uniquely identifies the control.
[Localizability(LocalizationCategory.NeverLocalize)]
public string? Key { get; set; }
Property Value
KeyTipText
The key tip text used to access the control.
[Localizability(LocalizationCategory.Label)]
public string? KeyTipText { get; set; }
Property Value
Label
The text label to display.
[Localizability(LocalizationCategory.Label)]
public string? Label { get; set; }
Property Value
PlaceholderText
The placeholder text to display when the control is empty.
[Localizability(LocalizationCategory.Text)]
public string? PlaceholderText { get; set; }
Property Value
RequestedWidth
The requested width of the control.
ScreenTipFooter
The screen tip footer content.
ScreenTipHeader
The screen tip header content.
SmallImageSource
The ImageSource for a small image, generally 16x16 size.
Title
The string title, which can override the Label when displayed in screen tips and customization UI.
[Localizability(LocalizationCategory.Title)]
public string? Title { 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 default value is Default.
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?)
Sizes the text box to its content.
protected override Size? MeasureOverride(Size? constraint)
| Parameter | Type | Description |
|---|---|---|
| constraint | Size | A System.Windows.Size structure that specifies the constraints on the size of the text box. |
Returns
- Size:
A System.Windows.Size structure indicating the new size of the text box.
OnCreateAutomationPeer()
Creates and returns an AutomationPeer object for the text box.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
An AutomationPeer object for the text box.
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked whenever an unhandled System.Windows.Input.Keyboard.GotKeyboardFocus attached routed event reaches an element derived from this class in its route. Implement this method to add class handling for this event.
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyboardFocusChangedEventArgs | Provides data 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 event data. |
OnLostKeyboardFocus(KeyboardFocusChangedEventArgs)
Invoked whenever an unhandled System.Windows.Input.Keyboard.LostKeyboardFocus attached routed event reaches an element derived from this class in its route. Implement this method to add class handling for this event.
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyboardFocusChangedEventArgs | Provides data about the event. |
OnPreviewKeyDown(KeyEventArgs)
Called when the KeyDown occurs.
protected override void OnPreviewKeyDown(KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | KeyEventArgs | The event data. |
OnPreviewMouseDown(MouseButtonEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.PreviewMouseDown attached routed 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 OnPreviewMouseDown(MouseButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseButtonEventArgs | The MouseButtonEventArgs that contains the event data. The event data reports that one or more mouse buttons were pressed. |
ToString()
Returns the string representation of this object.
Fields
CanCloneToRibbonQuickAccessToolBarProperty
Defines the CanCloneToRibbonQuickAccessToolBar property.
public static readonly DependencyProperty CanCloneToRibbonQuickAccessToolBarProperty
CommandParameterProperty
Defines the CommandParameter property.
public static readonly DependencyProperty CommandParameterProperty
CommandProperty
Defines the Command property.
public static readonly DependencyProperty CommandProperty
CommandTargetProperty
Defines the CommandTarget property.
public static readonly DependencyProperty CommandTargetProperty
InvocationFocusBehaviorProperty
Defines the InvocationFocusBehavior property.
public static readonly DependencyProperty InvocationFocusBehaviorProperty
IsStarSizingAllowedProperty
Defines the IsStarSizingAllowed property.
public static readonly DependencyProperty IsStarSizingAllowedProperty
KeyProperty
Defines the Key property.
public static readonly DependencyProperty KeyProperty
KeyTipTextProperty
Defines the KeyTipText property.
public static readonly DependencyProperty KeyTipTextProperty
LabelProperty
Defines the Label property.
public static readonly DependencyProperty LabelProperty
PlaceholderTextProperty
Defines the PlaceholderText property.
public static readonly DependencyProperty PlaceholderTextProperty
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
SmallImageSourceProperty
Defines the SmallImageSource property.
public static readonly DependencyProperty SmallImageSourceProperty
TitleProperty
Defines the Title property.
public static readonly DependencyProperty TitleProperty
ToolBarItemCollapseBehaviorProperty
Defines the ToolBarItemCollapseBehavior property.
public static readonly DependencyProperty ToolBarItemCollapseBehaviorProperty
VariantSizeProperty
Defines the VariantSize property.
public static readonly DependencyProperty VariantSizeProperty