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 a new instance of the BarTextBox class.
public BarTextBox()
Properties
CanCloneToRibbonQuickAccessToolBar
Gets or sets whether the control can be cloned to the ribbon quick-access toolbar.
public bool CanCloneToRibbonQuickAccessToolBar { get; set; }
Property Value
- bool:
true
if the control can be cloned to the ribbon quick-access toolbar; otherwise,false
. The default value istrue
.
Command
Gets or sets the ICommand to execute when text is committed.
public ICommand Command { get; set; }
Property Value
CommandParameter
Gets or sets the parameter for the Command.
CommandTarget
Gets or sets the IInputElement target for the Command.
public IInputElement CommandTarget { get; set; }
Property Value
- IInputElement:
The IInputElement target for the Command.
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 isfalse
.
Key
Gets or sets a string that uniquely identifies the control.
[Localizability(LocalizationCategory.NeverLocalize)]
public string Key { get; set; }
Property Value
- string:
A string that uniquely identifies the control.
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.
Label
Gets or sets the text label to display.
[Localizability(LocalizationCategory.Label)]
public string Label { get; set; }
Property Value
- string:
The text label to display.
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.
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.
ScreenTipHeader
Gets or sets the screen tip header content.
SmallImageSource
Gets or sets the ImageSource for a small image, generally 16x16
size.
public ImageSource SmallImageSource { get; set; }
Property Value
- ImageSource:
The ImageSource for a small image.
Title
Gets or sets 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
- string:
The string title.
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
.
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)
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 KeyTipInvokedEventArgs containing data related to this event. |
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
Identifies the CanCloneToRibbonQuickAccessToolBar dependency property. This field is read-only.
public static readonly DependencyProperty CanCloneToRibbonQuickAccessToolBarProperty
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
IsStarSizingAllowedProperty
Identifies the IsStarSizingAllowed dependency property. This field is read-only.
public static readonly DependencyProperty IsStarSizingAllowedProperty
KeyProperty
Identifies the Key dependency property. This field is read-only.
public static readonly DependencyProperty KeyProperty
KeyTipTextProperty
Identifies the KeyTipText dependency property. This field is read-only.
public static readonly DependencyProperty KeyTipTextProperty
LabelProperty
Identifies the Label dependency property. This field is read-only.
public static readonly DependencyProperty LabelProperty
PlaceholderTextProperty
Identifies the PlaceholderText dependency property. This field is read-only.
public static readonly DependencyProperty PlaceholderTextProperty
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
SmallImageSourceProperty
Identifies the SmallImageSource dependency property. This field is read-only.
public static readonly DependencyProperty SmallImageSourceProperty
TitleProperty
Identifies the Title dependency property. This field is read-only.
public static readonly DependencyProperty TitleProperty
ToolBarItemCollapseBehaviorProperty
Identifies the ToolBarItemCollapseBehavior dependency property. This field is read-only.
public static readonly DependencyProperty ToolBarItemCollapseBehaviorProperty
VariantSizeProperty
Identifies the VariantSize dependency property. This field is read-only.
public static readonly DependencyProperty VariantSizeProperty