ComponentOne Basic Library for UWP
Basic Library Overview / DropDown for UWP / DropDown for UWP Task-Based Help / Opening the Drop-Down on MouseOver
In This Topic
    Opening the Drop-Down on MouseOver
    In This Topic

    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.
    1. Navigate to the Properties window and click on the Events lightning bolt button to view events associated with the control.
    1. Double-click the box next to the IsMouseOverChanged item to switch to Code view and create the C1DropDown_IsMouseOverChanged event handler.
    1. In Code view, add the following import statement to the top of the page:
    C#
    Copy Code
    using C1.Xaml;
    
    1. Add code to the C1DropDown_IsMouseOver event handler so that it looks like the following:
    C#
    Copy Code
    private void C1DropDown_IsMouseOverChanged(object sender, PropertyChangedEventArgs<bool> e)
            {
                if (c1dropdown1.IsMouseOver == true)
                { 
                    c1dropdown1.IsDropDownOpen = true;
                } 
                else
                {
                    c1dropdown1.IsDropDownOpen = false; 
                }
            }
    
       

     What You've Accomplished

    In this topic you added code so that the drop-down box opens when moused over at run time using the IsDropDownOpen property. 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.

    See Also