DropdownList SelectedValue Property Delta Engine Documentation

Namespace: DeltaEngine.Scenes.Controls
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public Object SelectedValue { get; set; }

Property Value

Type: Object
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.DropdownListTests
Examples

7 unit tests call DeltaEngine.Scenes.Controls.DropdownList.SelectedValue
[Test, CloseAfterFirstFrame]
public void DefaultProperties()
{
    Assert.AreEqual(Values, dropdownList.Values);
    Assert.AreEqual(Values[0], dropdownList.SelectedValue);
    Assert.AreEqual(Center, dropdownList.DrawArea);
    Assert.AreEqual(Color.Gray, dropdownList.Color);
    Assert.AreEqual(3, dropdownList.SelectBox.texts.Count);
    Assert.IsFalse(dropdownList.IsPauseable);
    Assert.AreEqual(3, dropdownList.MaxDisplayCount);
}
[Test, CloseAfterFirstFrame]
public void IfValuesAreChangedButStillContainSelectedValueItRemainsSelected()
{
    var newValues = new List<object> { 1, "value 1", 2 };
    dropdownList.Values = newValues;
    Assert.AreEqual(newValues, dropdownList.Values);
    Assert.AreEqual("value 1", dropdownList.SelectedValue);
    Assert.AreEqual(3, dropdownList.SelectBox.texts.Count);
}
[Test, CloseAfterFirstFrame]
public void IfValuesAreChangedAndNoLongerContainSelectedValueItRevertsToFirstValue()
{
    var newValues = new List<object> { 1, 2 };
    dropdownList.Values = newValues;
    Assert.AreEqual(1, dropdownList.SelectedValue);
    Assert.AreEqual(2, dropdownList.SelectBox.texts.Count);
}
See Also