Back to Devexpress

EditorButton.Index Property

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-editorbutton-d9133a01.md

latest3.8 KB
Original Source

EditorButton.Index Property

Gets the button’s position within the owning collection.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[Browsable(false)]
public virtual int Index { get; }
vb
<Browsable(False)>
Public Overridable ReadOnly Property Index As Integer

Property Value

TypeDescription
Int32

A zero-based integer representing the button’s position.

|

Remarks

The ButtonEdit class and its descendants allow an unlimited number of buttons to be displayed within the editor. The collection of buttons can be accessed via the RepositoryItemButtonEdit.Buttons property. The Index property identifies the button’s position within the collection. The order of the buttons within the collection defines their visual order.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Index 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-custom-buttonedit-display-editvalue-on-button/CS/TestMyButtonEdit/MyButtonEditPainter.cs#L50

csharp
if (info.Bounds.Width == 0 || viewInfo.RightButtons.Count == 0) return;
if (info.Button.Index == 1)
{

winforms-grid-toggle-row-visibility/CS/WindowsApplication1/Form1.cs#L57

csharp
{
    if (e.Button.Index == 1)
        rowVisibilityHelper1.ToggleRowVisibility(GetButtonEditValue());

winforms-custom-buttonedit-display-editvalue-on-button/VB/TestMyButtonEdit/MyButtonEditPainter.vb#L50

vb
End If
If info.Button.Index = 1 Then
    MyBase.DrawButton(viewInfo, info)

winforms-grid-toggle-row-visibility/VB/WindowsApplication1/Form1.vb#L56

vb
Private Sub spinEdit1_ButtonClick(ByVal sender As Object, ByVal e As ButtonPressedEventArgs) Handles spinEdit1.ButtonClick
    If e.Button.Index = 1 Then
        rowVisibilityHelper1.ToggleRowVisibility(GetButtonEditValue())

See Also

Collection

EditorButton Class

EditorButton Members

DevExpress.XtraEditors.Controls Namespace