BarCommand Class
Defines the base requirements for a bar command.
[TypeConverter(typeof(BarCommandConverter))]
public abstract class BarCommand : Command, IImageListProvider
- Derived:
- BarButtonCommand BarCustomControlCommand BarExpanderButtonCommand BarLabelCommand BarPopupButtonCommand BarSplitButtonCommand
- Implements:
- IImageListProvider
Constructors
BarCommand(string, string, string?, int)
Initializes an instance of the class.
public BarCommand(string category, string name, string? text = null, int imageIndex = -1)
| Parameter | Type | Description |
|---|---|---|
| category | string | The category of the bar command. |
| name | string | The name of the bar command. |
| text | string | The text caption. |
| imageIndex | int | The index of an image within an |
Properties
BarManager
The BarManager that is managing the bar object.
CanCustomizeCreate
Indicates whether the bar command should be displayed in the Customize command list at run-time.
public bool CanCustomizeCreate { get; set; }
Property Value
- bool:
trueif the bar command should be displayed in the Customize command list at run-time; otherwise,false.
CanCustomizeKeyboardShortcuts
Indicates whether the bar command's keyboard shortcuts can be customized at run-time.
public bool CanCustomizeKeyboardShortcuts { get; set; }
Property Value
- bool:
trueif the bar command's keyboard shortcuts can be customized at run-time; otherwise,false.
Category
The category of the bar command.
CustomizeListText
The text to display in a Customize dialog command list (overrides the Text property).
public string? CustomizeListText { get; set; }
Property Value
Remarks
By default, commands display the Text property in the Customize dialog command lists. However if a value is specified for this property, it is used in the command lists instead.
Enabled
Indicates whether the bar command is enabled.
public bool Enabled { get; set; }
Property Value
- bool:
trueif the bar command is enabled; otherwise,false.
FullName
The full name of the command, which is formatted '[Category].[Name]' (e.g., "Edit.Copy").
Image
The image that is displayed for the bar command.
ImageIndex
The index of an image within an ImageList that is displayed for the bar command.
[ImageIndex]
[TypeConverter(typeof(ImageIndexConverter))]
public int ImageIndex { get; set; }
Property Value
- int:
The default value is
-1.
KeyboardShortcuts
The collection of keyboard shortcuts for the bar command.
public BarKeyboardShortcutCollection KeyboardShortcuts { get; }
Property Value
Name
The name of the command.
StaysOpenOnClick
Indicates whether any links for the bar command should keep a parent menu (if any) open when the link is clicked.
public bool StaysOpenOnClick { get; set; }
Property Value
- bool:
trueif the parent menu of a clicked link for the bar command should remain open; otherwise,false.
SupportsVerticalDisplay
Indicates whether the bar command supports a vertical display.
protected virtual bool SupportsVerticalDisplay { get; }
Property Value
- bool:
trueif the bar command supports a vertical display; otherwise,false.
Tag
The object that contains user-defined data about the object.
Text
The text of the bar command.
ToolTipEnabled
Indicates whether tooltips should display for command links associated with the command
public bool ToolTipEnabled { get; set; }
Property Value
- bool:
trueif tooltips should display for command links associated with the command; otherwise,false.
ToolTipText
The tool tip text for the bar command.
public virtual string? ToolTipText { get; set; }
Property Value
Remarks
The tool tip text will default to the Text property value (without . and & characters)
unless overridden with this property.
Methods
CloneToType(Type)
Creates a copy of the BarCommand.
protected virtual BarCommand CloneToType(Type targetType)
| Parameter | Type | Description |
|---|---|---|
| targetType | Type | The target Type. |
Returns
CreateCommandLink()
Creates a new BarCommandLink for the command.
OnEnabledChanged(EventArgs)
Raises the EnabledChanged event.
protected virtual void OnEnabledChanged(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The event data. |
OnProcessingRequested(BarProcessEventArgs)
Raises the ProcessingRequested event.
protected virtual void OnProcessingRequested(BarProcessEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarProcessEventArgs | The event data. |
Process(BarProcessEventArgs)
Performs processing based on some sort of event.
protected virtual void Process(BarProcessEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarProcessEventArgs | The event data. |
ReadAttributesFromXml(BarLayoutXmlSerializer)
Deserializes the attribute data for the BarCommandLink from XML.
protected virtual void ReadAttributesFromXml(BarLayoutXmlSerializer serializer)
| Parameter | Type | Description |
|---|---|---|
| serializer | BarLayoutXmlSerializer | The BarLayoutXmlSerializer to use. |
ReadElementFromXml(BarLayoutXmlSerializer)
Deserializes a child element for the BarCommandLink from XML.
protected virtual void ReadElementFromXml(BarLayoutXmlSerializer serializer)
| Parameter | Type | Description |
|---|---|---|
| serializer | BarLayoutXmlSerializer | The BarLayoutXmlSerializer to use. |
ResetCanCustomizeCreate()
Resets the CanCustomizeCreate property to its default value.
public virtual void ResetCanCustomizeCreate()
ResetCanCustomizeKeyboardShortcuts()
Resets the CanCustomizeKeyboardShortcuts property to its default value.
public virtual void ResetCanCustomizeKeyboardShortcuts()
ResetCategory()
Resets the Category property to its default value.
public virtual void ResetCategory()
ResetCustomizeListText()
Resets the CustomizeListText property to its default value.
public virtual void ResetCustomizeListText()
ResetEnabled()
Resets the Enabled property to its default value.
public virtual void ResetEnabled()
ResetImage()
Resets the Image property to its default value.
public virtual void ResetImage()
ResetImageIndex()
Resets the ImageIndex property to its default value.
public virtual void ResetImageIndex()
ResetStaysOpenOnClick()
Resets the StaysOpenOnClick property to its default value.
public virtual void ResetStaysOpenOnClick()
ResetText()
Resets the Text property to its default value.
public virtual void ResetText()
ResetToolTipEnabled()
Resets the ToolTipEnabled property to its default value.
public virtual void ResetToolTipEnabled()
ResetToolTipText()
Resets the ToolTipText property to its default value.
public virtual void ResetToolTipText()
ShouldSerializeCanCustomizeCreate()
Indicates whether the CanCustomizeCreate property should be persisted.
public virtual bool ShouldSerializeCanCustomizeCreate()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeCanCustomizeKeyboardShortcuts()
Indicates whether the CanCustomizeKeyboardShortcuts property should be persisted.
public virtual bool ShouldSerializeCanCustomizeKeyboardShortcuts()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeCategory()
Indicates whether the Category property should be persisted.
public virtual bool ShouldSerializeCategory()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeCustomizeListText()
Indicates whether the CustomizeListText property should be persisted.
public virtual bool ShouldSerializeCustomizeListText()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeEnabled()
Indicates whether the Enabled property should be persisted.
public virtual bool ShouldSerializeEnabled()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeImage()
Indicates whether the Image property should be persisted.
public virtual bool ShouldSerializeImage()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeImageIndex()
Indicates whether the ImageIndex property should be persisted.
public virtual bool ShouldSerializeImageIndex()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeStaysOpenOnClick()
Indicates whether the StaysOpenOnClick property should be persisted.
public virtual bool ShouldSerializeStaysOpenOnClick()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeText()
Indicates whether the Text property should be persisted.
public virtual bool ShouldSerializeText()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeToolTipEnabled()
Indicates whether the ToolTipEnabled property should be persisted.
public virtual bool ShouldSerializeToolTipEnabled()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
ShouldSerializeToolTipText()
Indicates whether the ToolTipText property should be persisted.
public virtual bool ShouldSerializeToolTipText()
Returns
- bool:
trueif the property value has changed from its default; otherwise,false.
UpdateState(BarCommandLinkEventArgs)
Notifies the command to update its state for the specified link.
public virtual void UpdateState(BarCommandLinkEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarCommandLinkEventArgs | The event data. |
WriteAttributesToXml(BarLayoutXmlSerializer)
Serializes the attribute data for the BarCommand to XML.
protected virtual void WriteAttributesToXml(BarLayoutXmlSerializer serializer)
| Parameter | Type | Description |
|---|---|---|
| serializer | BarLayoutXmlSerializer | The BarLayoutXmlSerializer to use. |
WriteElementsToXml(BarLayoutXmlSerializer)
Serializes the child element data for the BarCommand to XML.
protected virtual void WriteElementsToXml(BarLayoutXmlSerializer serializer)
| Parameter | Type | Description |
|---|---|---|
| serializer | BarLayoutXmlSerializer | The BarLayoutXmlSerializer to use. |
Events
EnabledChanged
Occurs when the Enabled property value has changed.
ProcessingRequested
Occurs when BarCommand processing is required.
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()