Basic Library for WPF and Silverlight | ComponentOne
WPF and Silverlight Edition Basic Library / Combo Box / ComboBox Features / Drop-Down List / Changing the Drop-Down List Direction
In This Topic
    Changing the Drop-Down List Direction
    In This Topic

    By default, when the user clicks the C1ComboBox control's drop-down arrow at run-time, the drop-down list will appear below the control; if that is not possible, it will appear above the control. You can, however, change the direction in which the drop-down list appears by setting the DropDownDirection property to one of the following four options:

    Event Description
    BelowOrAbove (default) Tries to open the drop-down list below the header. If it is not possible tries to open above it.
    AboveOrBelow Tries to open the drop-down list above the header. If it is not possible tries to open below it.
    ForceBelow Forces the drop-down list to open below the header.
    ForceAbove Forces the drop-down list to open above the header.

    You can change the drop-down list direction using one of the following methods:

    Complete the following steps:

    1. Add DropDownDirection="ForceAbove" to the <c1:C1ComboBox> tags so that the markup resembles the following:
    XAML
    Copy Code
    <c1:C1ComboBox Width="249" DropDownDirection="ForceAbove">
    
    1. Run the program and click the drop-down arrow. Observe that the drop-down list appears above the control.

    Complete the following steps:

    1. Add x:Name="C1ComboBox1" to the <c1:C1ComboBox> tag so that the object will have a unique identifier for you to call in code.
    2. Open the MainPage.xaml.cs or the MainWindow.xaml.cs page.
    3. Add following code beneath the InitializeComponent() method:
    Visual Basic
    Copy Code
    C1ComboBox1.DropDownDirection = ForceAbove
    

    C#
    Copy Code
    C1ComboBox1.DropDownDirection = ForceAbove;
    
    1. Run the program and click the drop-down arrow. Observe that the drop-down list appears above the control.

    Complete the following steps:

    1. Click the C1ComboBox control once to select it.
    2. In the Properties window, click the DropDownDirection drop-down arrow and select an option. For this example, select ForceAbove.
    3. Run the program and click the drop-down arrow. Observe that the drop-down list appears above the control.