BarCommand Class
Defines the base requirements for a bar command.
public abstract class BarCommand : Command, IImageListProvider
- Derived:
- BarButtonCommand BarCustomControlCommand BarExpanderButtonCommand BarLabelCommand BarPopupButtonCommand BarSplitButtonCommand
- Implements:
- IImageListProvider
Constructors
BarCommand(String, String, String, Int32)
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 | Int32 | The index of an image within an |
Properties
BarManager
Gets the BarManager that is managing the bar object.
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
- Boolean:
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
- Boolean:
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.
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
- Boolean:
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]
public int ImageIndex { get; set; }
Property Value
- Int32:
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
- Boolean:
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
- Boolean:
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.
public object Tag { get; set; }
Property Value
Remarks
Any type derived from the Object class can be assigned to this property.
Text
Gets or sets 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
- Boolean:
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.
CreateCommandLink()
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 |
OnProcessingRequested(BarProcessEventArgs)
Raises the ProcessingRequested
event.
protected virtual void OnProcessingRequested(BarProcessEventArgs e)
Parameter | Type | Description |
---|---|---|
e | BarProcessEventArgs | A |
Process(BarProcessEventArgs)
Performs processing based on some sort of event.
protected virtual void Process(BarProcessEventArgs e)
Parameter | Type | Description |
---|---|---|
e | BarProcessEventArgs | A |
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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
- Boolean:
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 |
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.
Explicit Interface Implementations
IImageListProvider.GetImageList(Object, Object)
Returns an ImageList
for the specified element and context.
ImageList IImageListProvider.GetImageList(object requestor, object context)
Parameter | Type | Description |
---|---|---|
requestor | Object | The object that is requesting the |
context | Object | An object that provides context information. |
Returns
- ImageList:
The
ImageList
that should be used.