In This Article

BarCommand Class

Defines the base requirements for a bar command.

[TypeConverter(typeof(BarCommandConverter))]
public abstract class BarCommand : Command, IImageListProvider
Inheritance:
object Command object
Derived:
BarButtonCommand BarCustomControlCommand BarExpanderButtonCommand BarLabelCommand BarPopupButtonCommand BarSplitButtonCommand
Implements:
IImageListProvider

Constructors

BarCommand(string, string, string, int)

Initializes a new instance of the BarCommand class.

public BarCommand(string category, string name, string text, int imageIndex)
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 ImageList.

Properties

BarManager

Gets the BarManager that is managing the bar object.

[Browsable(false)]
public BarManager BarManager { get; }

Property Value

BarManager:

The BarManager that is managing the bar object.

CanCustomizeCreate

Gets or sets whether the bar command should be displayed in the Customize command list at run-time.

public bool CanCustomizeCreate { get; set; }

Property Value

bool:

true if the bar command should be displayed in the Customize command list at run-time; otherwise, false.

CanCustomizeKeyboardShortcuts

Gets or sets whether the bar command's keyboard shortcuts can be customized at run-time.

public bool CanCustomizeKeyboardShortcuts { get; set; }

Property Value

bool:

true if the bar command's keyboard shortcuts can be customized at run-time; otherwise, false.

Category

Gets or sets the category of the bar command.

public string Category { get; set; }

Property Value

string:

The category of the bar command.

CustomizeListText

Gets or sets the text to display in a Customize dialog command list (overrides the Text property).

public string CustomizeListText { get; set; }

Property Value

string:

The text to display in a Customize dialog command list.

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

Gets or sets whether the bar command is enabled.

public bool Enabled { get; set; }

Property Value

bool:

true if the bar command is enabled; otherwise, false.

FullName

Gets the full name of the command, which is [Category].[Name].

public string FullName { get; }

Property Value

string:

The full name of the command, which is [Category].[Name].

Image

Gets or sets the image that is displayed for the bar command.

public Image Image { get; set; }

Property Value

Image:

The Image displayed for the bar command. The default value is null.

ImageIndex

Gets or sets 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 index of an image within an ImageList that is displayed for the bar command. The default value is -1.

KeyboardShortcuts

Gets or sets the collection of keyboard shortcuts for the bar command.

public BarKeyboardShortcutCollection KeyboardShortcuts { get; }

Property Value

BarKeyboardShortcutCollection:

A BarKeyboardShortcutCollection of keyboard shortcuts for the bar command.

StaysOpenOnClick

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

true if the parent menu of a clicked link for the bar command should remain open; otherwise, false.

SupportsVerticalDisplay

Gets whether the bar command supports a vertical display.

protected virtual bool SupportsVerticalDisplay { get; }

Property Value

bool:

true if the bar command supports a vertical display; otherwise, false.

Tag

Gets or sets the object that contains user-defined data about the object.

[TypeConverter(typeof(StringConverter))]
public object Tag { get; set; }

Property Value

object:

An object that contains user-defined data about the control. The default is null.

Remarks

Any type derived from the object class can be assigned to this property.

Text

Gets or sets the text of the bar command.

public string Text { get; set; }

Property Value

string:

The text of the bar command.

ToolTipEnabled

Gets or sets whether tooltips should display for command links associated with the command

public bool ToolTipEnabled { get; set; }

Property Value

bool:

true if tooltips should display for command links associated with the command; otherwise, false.

ToolTipText

Gets or sets the tool tip text for the bar command.

public virtual string ToolTipText { get; set; }

Property Value

string:

The tool tip text for the bar command.

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

BarCommand:

The copy of the BarCommand.

Creates a new BarCommandLink for the command.

public abstract BarCommandLink CreateCommandLink()

Returns

BarCommandLink:

The BarCommandLink that was created.

OnEnabledChanged(EventArgs)

Raises the EnabledChanged event.

protected virtual void OnEnabledChanged(EventArgs e)
Parameter Type Description
e EventArgs

A EventArgs that contains the event data.

OnProcessingRequested(BarProcessEventArgs)

Raises the ProcessingRequested event.

protected virtual void OnProcessingRequested(BarProcessEventArgs e)
Parameter Type Description
e BarProcessEventArgs

A BarProcessEventArgs that contains the event data.

Process(BarProcessEventArgs)

Performs processing based on some sort of event.

protected virtual void Process(BarProcessEventArgs e)
Parameter Type Description
e BarProcessEventArgs

A BarProcessEventArgs that contains 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:

true if 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:

true if 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:

true if 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:

true if 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:

true if 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:

true if 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:

true if 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:

true if 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:

true if 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:

true if 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:

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

A BarCommandLinkEventArgs that contains 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.

public event EventHandler EnabledChanged

Event Type

EventHandler

ProcessingRequested

Occurs when BarCommand processing is required.

public event BarProcessEventHandler ProcessingRequested

Event Type

BarProcessEventHandler

Inherited Members