By default, the C1DropDown control’s drop-down box only opens when users click on the drop-down arrow at run time. In this topic you’ll set the drop-down box to open when users mouse over the control at run-time instead. Note that this topic assumes you have already added a C1DropDown control which contains content to the application.
Complete the following steps:
1. Click once on the C1DropDown control to select it.
2. Navigate to the Properties window and click on the lightning bolt Events button to view events associated with the control.
3. Double-click the box next to the IsMouseOverChanged item to switch to Code view and create the C1DropDown_IsMouseOver event handler.
4. In Code view, add the following import statement to the top of the page:
Imports C1.WPF
•C#
using C1.WPF;
5. Add code to the C1DropDown_IsMouseOver event handler so it looks like the following:
Private Sub C1DropDown1_IsMouseOverChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs(Of Boolean))
If C1DropDown1.IsMouseOver = True Then
C1DropDown1.IsDropDownOpen = True
Else
C1DropDown1.IsDropDownOpen = False
End If
End Sub
•C#
private void c1DropDown1_IsMouseOverChanged(object sender, PropertyChangedEventArgs<bool> e)
{
if (c1DropDown1.IsMouseOver == true)
{
c1DropDown1.IsDropDownOpen = true;
}
else
{
c1DropDown1.IsDropDownOpen = false;
}
}
This code sets the C1DropDown control’s actions when a user moves the cursor over the control at run time.
What You've Accomplished
In this topic you added code setting the IsDropDownOpen property so that the drop-down box opens on mouse over at run time. Run the application and move the mouse over the control. Notice that the drop-down box opens. Move the mouse away from the control and observe that the drop-down box closes.