Skip to content

ComboBoxItemTextImage Class

Mauricio Jorquera edited this page Nov 14, 2023 · 3 revisions

Description

Namespace: SCADtools.Revit.UI

This class represents an item within the LabelComboBoxImage class and has two properties: ItemTitle and ItemText.

Example

The following example creates a list of bar types and assigns it to the ItemText property of the LabelComboBoxImage object.

C#

List<ComboBoxItemTextImage> comboBoxItemsTextImage = new List<ComboBoxItemTextImage>()
{
    new ComboBoxItemTextImage() { ItemTitle = "Rebar Shape : ", ItemText = "B1",
           ItemImage = new BitmapImage(new Uri("pack://application:,,,/OptionsBarSample;component/Images/B1.png",
                                               UriKind.Absolute)),
           IsVisibleImageCollapsed = true },
    new ComboBoxItemTextImage() { ItemTitle = "Rebar Shape : ", ItemText = "B2",
           ItemImage = new BitmapImage(new Uri("pack://application:,,,/OptionsBarSample;component/Images/B2.png",
                                               UriKind.Absolute)),
           IsVisibleImageCollapsed = true },
    new ComboBoxItemTextImage() { ItemTitle = "Rebar Shape : ", ItemText = "B3",
           ItemImage = new BitmapImage(new Uri("pack://application:,,,/OptionsBarSample;component/Images/B3.png",
                                               UriKind.Absolute)),
           IsVisibleImageCollapsed = true }
};
LabelComboBoxImage labelComboBoxImage = new LabelComboBoxImage()
{
    ShowLabel = false,
    ItemsTextImage = comboBoxItemsTextImage,
    ComboBoxWidth = 220,
};

Properties

Name Description
ItemTitle Gets or sets a title for the selected item to be displayed when the combobox is collapsed.
ItemText Gets or sets the text associated with the selected item, which will be displayed in the expanded list when the combobox is dropped down.
ItemImage Gets or sets the image associated with the selected item, which will be displayed in the expanded list when the combobox is dropped down.
IsVisibleImageCollapsed Gets or sets the value that indicates whether the image associated with the selected item will be displayed when the combobox is collapsed.

Remarks

If the user does not want to display text in the ItemTitle property, they can leave it unassigned or set its value to empty.