TX Text Control .NET for Windows Forms

SelectedIndex Property

Property|Introduced in 29.0
Namespace
TXTextControl.Windows.Forms.Ribbon
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.Windows.Forms.dll from the private NuGet feed or Text Control Offline Packages

Description

Gets or sets the index of the currently selected drop-down item. Setting -1 deselects the current selected drop-down item. If the RibbonListViewItemDropDown.ShowCheckMargin property is set to true, the corresponding item of the drop-down menu is checked when it is opened . If the RibbonListViewItemDropDown.ShowText property is set to true, setting this property updates the RibbonListViewItemDropDown.Text property with the text of the corresponding RibbonListViewItemDropDown.SelectedItem property value. The default value is -1.

Syntax

public int SelectedIndex { get; set; }

Examples

The following example uses RibbonListViewItemDropDown.SelectedIndex to configure selected index as part of the ribbon list view item drop down workflow. The configured value is checked before the workflow continues.

ribbonListViewItemDropDown.SelectedIndex = 1;
Console.WriteLine($"Selected Index used by Ribbon List View Item Drop Down: {ribbonListViewItemDropDown.SelectedIndex}");

Remarks

A System.IndexOutOfRangeException is thrown if the set value is less than -1 or larger than or equals to the number of drop-down items.