Search Results for

    Show / Hide Table of Contents

    Class Dropdown

    Dropdown menu control allows to choose one item from the provided collection of options.

    Inheritance
    System.Object
    Control
    ContainerControl
    Dropdown
    Implements
    System.IComparable
    IDrawable
    Inherited Members
    ContainerControl._children
    ContainerControl._containsFocus
    ContainerControl._isLayoutLocked
    ContainerControl.LockChildrenRecursive()
    ContainerControl.UnlockChildrenRecursive()
    ContainerControl.RemoveChildren()
    ContainerControl.DisposeChildren()
    ContainerControl.AddChild<T>()
    ContainerControl.AddChild<T>(T)
    ContainerControl.RemoveChild(Control)
    ContainerControl.GetChild(Int32)
    ContainerControl.GetChild<T>()
    ContainerControl.GetChildIndex(Control)
    ContainerControl.GetChildIndexAt(Float2)
    ContainerControl.GetChildAt(Float2)
    ContainerControl.GetChildAt(Float2, Func<Control, Boolean>)
    ContainerControl.GetChildAtRecursive(Float2)
    ContainerControl.GetClientArea()
    ContainerControl.SortChildren()
    ContainerControl.SortChildrenRecursive()
    ContainerControl.OnChildResized(Control)
    ContainerControl.OnChildrenChanged()
    ContainerControl.GetDesireClientArea(Rectangle)
    ContainerControl.IntersectsChildContent(Control, Float2, Float2)
    ContainerControl.OnNavigate(NavDirection, Float2, Control, List<Control>)
    ContainerControl.CanNavigateChild(Control)
    ContainerControl.NavigationWrap(NavDirection, Float2, List<Control>, Float2)
    ContainerControl.UpdateContainsFocus()
    ContainerControl.UpdateChildrenBounds()
    ContainerControl.PerformLayoutBeforeChildren()
    ContainerControl.PerformLayoutAfterChildren()
    ContainerControl.Update(Single)
    ContainerControl.ClearState()
    ContainerControl.Draw()
    ContainerControl.DrawChildren()
    ContainerControl.ContainsPoint(Float2, Boolean)
    ContainerControl.PerformLayout(Boolean)
    ContainerControl.RayCast(Float2, Control)
    ContainerControl.OnMouseEnter(Float2)
    ContainerControl.OnMouseMove(Float2)
    ContainerControl.OnMouseWheel(Float2, Single)
    ContainerControl.IsTouchPointerOver(Int32)
    ContainerControl.OnTouchEnter(Float2, Int32)
    ContainerControl.OnTouchMove(Float2, Int32)
    ContainerControl.OnCharInput(Char)
    ContainerControl.OnKeyDown(KeyboardKeys)
    ContainerControl.OnKeyUp(KeyboardKeys)
    ContainerControl.OnDragEnter(Float2, DragData)
    ContainerControl.OnDragMove(Float2, DragData)
    ContainerControl.OnDragLeave()
    ContainerControl.OnDragDrop(Float2, DragData)
    ContainerControl.OnSizeChanged()
    ContainerControl.Children
    ContainerControl.ChildrenCount
    ContainerControl.HasChildren
    ContainerControl.ContainsFocus
    ContainerControl.ClipChildren
    ContainerControl.CullChildren
    ContainerControl.IsTouchOver
    Control.Resize(Float2)
    Control.UpdateBounds()
    Control.UpdateTransform()
    Control.SetAnchorPreset(AnchorPresets, Boolean, Boolean)
    Control.Dispose()
    Control.Focus()
    Control.Defocus()
    Control.OnGotFocus()
    Control.OnStartContainsFocus()
    Control.OnEndContainsFocus()
    Control.Focus(Control)
    Control.StartMouseCapture(Boolean)
    Control.EndMouseCapture()
    Control.OnEndMouseCapture()
    Control.GetNavTarget(NavDirection)
    Control.GetNavOrigin(NavDirection)
    Control.NavigationFocus()
    Control.OnTouchLeave()
    Control.DoDragDrop(DragData)
    Control.LinkTooltip(String, Tooltip)
    Control.UnlinkTooltip()
    Control.OnShowTooltip(String, Float2, Rectangle)
    Control.OnTooltipShown(Tooltip)
    Control.OnTestTooltipOverControl(Float2)
    Control.IntersectsContent(Float2, Float2)
    Control.PointToParent(ContainerControl, Float2)
    Control.PointToParent(Float2)
    Control.PointToParent(Float2)
    Control.PointFromParent(Float2)
    Control.PointFromParent(Float2)
    Control.PointFromParent(ContainerControl, Float2)
    Control.PointToWindow(Float2)
    Control.PointFromWindow(Float2)
    Control.PointToScreen(Float2)
    Control.PointFromScreen(Float2)
    Control.OnLocationChanged()
    Control.SetScaleInternal(Float2)
    Control.SetPivotInternal(Float2)
    Control.SetShearInternal(Float2)
    Control.SetRotationInternal(Single)
    Control.OnVisibleChanged()
    Control.OnParentChangedInternal()
    Control.AddUpdateCallbacks(RootControl)
    Control.RemoveUpdateCallbacks(RootControl)
    Control.SetUpdate(Control.UpdateDelegate, Control.UpdateDelegate)
    Control.OnParentResized()
    Control.CompareTo(Object)
    Control.Compare(Control)
    Control.Top
    Control.Bottom
    Control.Left
    Control.Right
    Control.UpperLeft
    Control.UpperRight
    Control.BottomRight
    Control.BottomLeft
    Control.Scale
    Control.Pivot
    Control.Shear
    Control.Rotation
    Control.HasParent
    Control.BackgroundColor
    Control.BackgroundBrush
    Control.Enabled
    Control.EnabledInHierarchy
    Control.Visible
    Control.VisibleInHierarchy
    Control.IsDisposing
    Control.Root
    Control.RootWindow
    Control.DpiScale
    Control.ScreenPos
    Control.AutoFocus
    Control.IsFocused
    Control.IsNavFocused
    Control.IsMouseOver
    Control.IsDragOver
    Control.Tooltip
    Control.ShowTooltip
    Control.EditorBounds
    Control.LocationChanged
    Control.SizeChanged
    Control.ParentChanged
    Control.VisibleChanged
    Namespace: FlaxEngine.GUI
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [ActorToolbox("GUI")]
    public class Dropdown : ContainerControl, IComparable, IDrawable

    Constructors

    Dropdown()

    Initializes a new instance of the Dropdown class.

    Declaration
    public Dropdown()

    Fields

    _items

    The items.

    Declaration
    protected List<LocalizedString> _items
    Field Value
    System.Collections.Generic.List<LocalizedString>

    _popup

    The popup menu. May be null if has not been used yet.

    Declaration
    protected Dropdown.DropdownRoot _popup
    Field Value
    FlaxEngine.GUI.Dropdown.DropdownRoot

    _selectedIndex

    The selected index of the item (-1 for no selection).

    Declaration
    protected int _selectedIndex
    Field Value
    System.Int32

    Properties

    ArrowColor

    Gets or sets the color used to render dropdown drop arrow icon.

    Declaration
    [EditorDisplay("Icon Style", null)]
    [EditorOrder(2030)]
    [Tooltip("The color used to render dropdown drop arrow icon.")]
    [ExpandGroups]
    public Color ArrowColor { get; set; }
    Property Value
    Color

    ArrowColorHighlighted

    Gets or sets the color used to render dropdown drop arrow icon (menu is highlighted).

    Declaration
    [EditorDisplay("Icon Style", null)]
    [EditorOrder(2031)]
    [Tooltip("The color used to render dropdown drop arrow icon (menu is highlighted).")]
    public Color ArrowColorHighlighted { get; set; }
    Property Value
    Color

    ArrowColorSelected

    Gets or sets the color used to render dropdown drop arrow icon (menu is opened).

    Declaration
    [EditorDisplay("Icon Style", null)]
    [EditorOrder(2032)]
    [Tooltip("The color used to render dropdown drop arrow icon (menu is opened).")]
    public Color ArrowColorSelected { get; set; }
    Property Value
    Color

    ArrowImage

    Gets or sets the image used to render dropdown drop arrow icon.

    Declaration
    [EditorDisplay("Icon Style", null)]
    [EditorOrder(2033)]
    [Tooltip("The image used to render dropdown drop arrow icon.")]
    public IBrush ArrowImage { get; set; }
    Property Value
    IBrush

    BackgroundColorHighlighted

    Gets or sets the background color when dropdown is highlighted.

    Declaration
    [EditorDisplay("Background Style", null)]
    [EditorOrder(2001)]
    [ExpandGroups]
    public Color BackgroundColorHighlighted { get; set; }
    Property Value
    Color

    BackgroundColorSelected

    Gets or sets the background color when dropdown popup is opened.

    Declaration
    [EditorDisplay("Background Style", null)]
    [EditorOrder(2002)]
    public Color BackgroundColorSelected { get; set; }
    Property Value
    Color

    BorderColor

    Gets or sets the color of the border.

    Declaration
    [EditorDisplay("Border Style", null)]
    [EditorOrder(2010)]
    [ExpandGroups]
    public Color BorderColor { get; set; }
    Property Value
    Color

    BorderColorHighlighted

    Gets or sets the border color when dropdown is highlighted.

    Declaration
    [EditorDisplay("Border Style", null)]
    [EditorOrder(2013)]
    public Color BorderColorHighlighted { get; set; }
    Property Value
    Color

    BorderColorSelected

    Gets or sets the border color when dropdown popup is opened.

    Declaration
    [EditorDisplay("Border Style", null)]
    [EditorOrder(2012)]
    public Color BorderColorSelected { get; set; }
    Property Value
    Color

    CheckedImage

    Gets or sets the image used to render dropdown checked item icon.

    Declaration
    [EditorDisplay("Icon Style", null)]
    [EditorOrder(2034)]
    [Tooltip("The image used to render dropdown checked item icon.")]
    public IBrush CheckedImage { get; set; }
    Property Value
    IBrush

    Font

    Gets or sets the font used to draw text.

    Declaration
    [EditorDisplay("Text Style", null)]
    [EditorOrder(2020)]
    public FontReference Font { get; set; }
    Property Value
    FontReference

    FontMaterial

    Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.

    Declaration
    [EditorDisplay("Text Style", null)]
    [EditorOrder(2021)]
    public MaterialBase FontMaterial { get; set; }
    Property Value
    MaterialBase

    HorizontalAlignment

    Gets or sets the horizontal text alignment within the control bounds.

    Declaration
    [EditorDisplay("Text Style", null)]
    [EditorOrder(2027)]
    public TextAlignment HorizontalAlignment { get; set; }
    Property Value
    TextAlignment

    IsPopupOpened

    Gets a value indicating whether this popup menu is opened.

    Declaration
    public bool IsPopupOpened { get; }
    Property Value
    System.Boolean

    Items

    Gets or sets the items collection.

    Declaration
    [EditorOrder(1)]
    public List<LocalizedString> Items { get; set; }
    Property Value
    System.Collections.Generic.List<LocalizedString>

    SelectedIndex

    Gets or sets the index of the selected.

    Declaration
    [EditorOrder(2)]
    [Limit(-1F, 3.40282347E+38F, 1F)]
    [Tooltip("The index of the selected item from the list.")]
    public int SelectedIndex { get; set; }
    Property Value
    System.Int32

    ShowAllItems

    Gets or sets whether to show all the items in the dropdown.

    Declaration
    [EditorOrder(3)]
    public bool ShowAllItems { get; set; }
    Property Value
    System.Boolean

    ShowMaxItemsCount

    Gets or sets the maximum number of items to show at once. Only used if ShowAllItems is false.

    Declaration
    [EditorOrder(4)]
    [VisibleIf("ShowAllItems", true)]
    [Limit(1F, 3.40282347E+38F, 1F)]
    public int ShowMaxItemsCount { get; set; }
    Property Value
    System.Int32

    TextColor

    Gets or sets the color of the text.

    Declaration
    [EditorDisplay("Text Style", null)]
    [EditorOrder(2023)]
    [ExpandGroups]
    public Color TextColor { get; set; }
    Property Value
    Color

    TextFormat

    Gets or sets the custom text format for selected item displaying. Can be used to prefix or/and postfix actual selected value within the drowpdown control text where '{0}' is used to insert selected value text. Example: 'Selected: {0}'. Leave empty if unussed.

    Declaration
    [EditorDisplay("Text Style", null)]
    [EditorOrder(2022)]
    public LocalizedString TextFormat { get; set; }
    Property Value
    LocalizedString

    VerticalAlignment

    Gets or sets the vertical text alignment within the control bounds.

    Declaration
    [EditorDisplay("Text Style", null)]
    [EditorOrder(2028)]
    public TextAlignment VerticalAlignment { get; set; }
    Property Value
    TextAlignment

    Methods

    AddItem(String)

    Adds the item.

    Declaration
    public void AddItem(string item)
    Parameters
    System.String item

    The item.

    AddItems(IEnumerable<String>)

    Adds the items.

    Declaration
    public void AddItems(IEnumerable<string> items)
    Parameters
    System.Collections.Generic.IEnumerable<System.String> items

    The items.

    ClearItems()

    Clears the items.

    Declaration
    public void ClearItems()

    CreatePopup()

    Creates the popup menu (including items collection).

    Declaration
    protected virtual Dropdown.DropdownRoot CreatePopup()
    Returns
    FlaxEngine.GUI.Dropdown.DropdownRoot

    CreatePopupBackground(Dropdown.DropdownRoot)

    Creates the popup background. Called by default implementation of CreatePopup() and allows to customize popup background by adding controls to it.

    Declaration
    protected virtual void CreatePopupBackground(Dropdown.DropdownRoot popup)
    Parameters
    FlaxEngine.GUI.Dropdown.DropdownRoot popup

    The popup control where background controls can be added.

    CreatePopupItem(Int32, Float2, Single)

    Creates the popup item. Called by default implementation of CreatePopup() and allows to customize popup item.

    Declaration
    protected virtual Control CreatePopupItem(int i, Float2 size, float margin)
    Parameters
    System.Int32 i

    The item index.

    Float2 size

    The item control size

    System.Single margin

    The item control left-side margin

    Returns
    Control

    Custom popup item control.

    CreatePopupRoot()

    Creates the popup root. Called by default implementation of CreatePopup() and allows to customize popup base.

    Declaration
    protected virtual Dropdown.DropdownRoot CreatePopupRoot()
    Returns
    FlaxEngine.GUI.Dropdown.DropdownRoot

    Custom popup root control.

    DestroyPopup()

    Destroys the popup.

    Declaration
    protected virtual void DestroyPopup()

    DrawSelf()

    Draws the control.

    Declaration
    public override void DrawSelf()
    Overrides
    ContainerControl.DrawSelf()

    HidePopup()

    Hides the popup.

    Declaration
    public void HidePopup()

    OnDestroy()

    Method called when managed instance should be destroyed

    Declaration
    public override void OnDestroy()
    Overrides
    ContainerControl.OnDestroy()

    OnItemClicked(Int32)

    Called when item is clicked.

    Declaration
    protected virtual void OnItemClicked(int index)
    Parameters
    System.Int32 index

    The index.

    OnLostFocus()

    When control losts input focus

    Declaration
    public override void OnLostFocus()
    Overrides
    Control.OnLostFocus()

    OnMouseDoubleClick(Float2, MouseButton)

    When mouse double clicks over control's area

    Declaration
    public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    ContainerControl.OnMouseDoubleClick(Float2, MouseButton)

    OnMouseDown(Float2, MouseButton)

    When mouse goes down over control's area

    Declaration
    public override bool OnMouseDown(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    ContainerControl.OnMouseDown(Float2, MouseButton)

    OnMouseLeave()

    When mouse leaves control's area

    Declaration
    public override void OnMouseLeave()
    Overrides
    ContainerControl.OnMouseLeave()

    OnMouseUp(Float2, MouseButton)

    When mouse goes up over control's area

    Declaration
    public override bool OnMouseUp(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    ContainerControl.OnMouseUp(Float2, MouseButton)

    OnPopupHide()

    Called when popup menu gets hidden.

    Declaration
    protected virtual void OnPopupHide()

    OnPopupShow()

    Called when popup menu gets shown.

    Declaration
    protected virtual void OnPopupShow()

    OnSelectedIndexChanged()

    Called when selected item index gets changed.

    Declaration
    protected virtual void OnSelectedIndexChanged()

    OnSubmit()

    Generic user interaction event for a control used by UI navigation (eg. user submits on the currently focused control).

    Declaration
    public override void OnSubmit()
    Overrides
    Control.OnSubmit()

    OnTouchDown(Float2, Int32)

    When touch enters control's area.

    Declaration
    public override bool OnTouchDown(Float2 location, int pointerId)
    Parameters
    Float2 location

    Touch location in Control Space.

    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Returns
    System.Boolean

    True if event has been handled, otherwise false.

    Overrides
    ContainerControl.OnTouchDown(Float2, Int32)

    OnTouchLeave(Int32)

    When touch leaves control's area

    Declaration
    public override void OnTouchLeave(int pointerId)
    Parameters
    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Overrides
    ContainerControl.OnTouchLeave(Int32)

    OnTouchUp(Float2, Int32)

    When touch goes up over control's area.

    Declaration
    public override bool OnTouchUp(Float2 location, int pointerId)
    Parameters
    Float2 location

    Touch location in Control Space

    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Returns
    System.Boolean

    True if event has been handled, otherwise false.

    Overrides
    ContainerControl.OnTouchUp(Float2, Int32)

    SetItems(IEnumerable<String>)

    Sets the items.

    Declaration
    public void SetItems(IEnumerable<string> items)
    Parameters
    System.Collections.Generic.IEnumerable<System.String> items

    The items.

    ShowPopup()

    Shows the popup.

    Declaration
    public void ShowPopup()

    Events

    SelectedIndexChanged

    Event fired when selected index gets changed.

    Declaration
    public event Action<Dropdown> SelectedIndexChanged
    Event Type
    System.Action<Dropdown>

    SelectedItemChanged

    Event fired when selected item gets changed.

    Declaration
    public event Action SelectedItemChanged
    Event Type
    System.Action

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)

    See Also

    ContainerControl
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat