Back to Devexpress

BarItem.Name Property

windowsforms-devexpress-dot-xtrabars-dot-baritem-aa1b2075.md

latest3.3 KB
Original Source

BarItem.Name Property

Gets or sets the BarItem‘s name.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[Browsable(false)]
[DefaultValue("")]
public string Name { get; set; }
vb
<Browsable(False)>
<DefaultValue("")>
Public Property Name As String

Property Value

TypeDefaultDescription
StringString.Empty

The BarItem‘s name.

|

Remarks

The Name property can be used at runtime to evaluate an object by its name rather than by its type and programmatic name.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Name property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-ribbon-paint-bar-items/CS/WindowsApplication3/Form1.cs#L16

csharp
e.RibbonItemInfo.Appearance.ForeColor = Color.Red;
if(link.Item.Name == "barButtonItem1") {
    if(e.State == DevExpress.XtraBars.ViewInfo.BarLinkState.Highlighted) {

winforms-assign-popupmenu-to-dropdownbutton/CS/DropDownButtonExample/Form1.cs#L31

csharp
item.ImageOptions.ImageIndex = imageIndex;
item.Name = name;
return item;

winforms-ribbon-paint-bar-items/VB/WindowsApplication3/Form1.vb#L19

vb
If TypeOf link Is BarSubItemLink Then e.RibbonItemInfo.Appearance.ForeColor = Color.Red
If Equals(link.Item.Name, "barButtonItem1") Then
    If e.State = ViewInfo.BarLinkState.Highlighted Then

winforms-assign-popupmenu-to-dropdownbutton/VB/DropDownButtonExample/Form1.vb#L32

vb
item.ImageOptions.ImageIndex = imageIndex
item.Name = name
Return item

See Also

BarItem Class

BarItem Members

DevExpress.XtraBars Namespace