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:
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:
- Add DropDownDirection="ForceAbove" to the <c1:C1ComboBox> tags so that the markup resembles the following:
XAML |
Copy Code
|
<c1:C1ComboBox Width="249" DropDownDirection="ForceAbove">
|
- Run the program and click the drop-down arrow. Observe that the drop-down list appears above the control.
Complete the following steps:
- Add x:Name="C1ComboBox1" to the <c1:C1ComboBox> tag so that the object will have a unique identifier for you to call in code.
- Open the MainPage.xaml.cs or the MainWindow.xaml.cs page.
- Add following code beneath the InitializeComponent() method:
Visual Basic |
Copy Code
|
C1ComboBox1.DropDownDirection = ForceAbove
|
C# |
Copy Code
|
C1ComboBox1.DropDownDirection = ForceAbove;
|
- Run the program and click the drop-down arrow. Observe that the drop-down list appears above the control.
Complete the following steps:
- Click the C1ComboBox control once to select it.
- In the Properties window, click the DropDownDirection drop-down arrow and select an option. For this example, select ForceAbove.
- Run the program and click the drop-down arrow. Observe that the drop-down list appears above the control.