TX Text Control .NET for Windows Forms

SelectedItem 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 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 . Setting null or a string that is not part of the RibbonListViewItemDropDown.Items string array deselects the current selected drop-down item. If the RibbonListViewItemDropDown.ShowText property is set to true, setting this property updates the RibbonListViewItemDropDown.Text property with the same value. The default value is null.

Syntax

public string SelectedItem { get; set; }

Examples

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

ribbonListViewItemDropDown.SelectedItem = "Quarterly report";
if (!string.IsNullOrWhiteSpace(ribbonListViewItemDropDown.SelectedItem))
{
    Console.WriteLine($"Selected Item: {ribbonListViewItemDropDown.SelectedItem}");
}