Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1030
XamDateTimeEditior - Open dropdown in click event
posted

Hi,

 

I have a XamDateTimeEditor. I want to open the Calendar if i click anywhere inside the XamDateTimeEditor and on the next immediate click it has to close. I tried this by setting IsDropDownOpen property in PreviewMouseDown event. It opens only when control doesn't have a focus. If control already has focus then it is not working. Let me know is there any other simple way to do this...

Thanks

Kumaran

  • 35319
    posted

    Hello kumaran,

     

    I am just checking if my last reply was helpful for you.

     

    If you require any further assistance please do not hesitate to ask.

  • 35319
    posted

    Hello kumaran,

    I have been looking into your post and I can suggest you implement the following code in the body of the ‘PreviewMouseLeftButtonDown’ event of the XamDateTimeEditor :

     

    private void editor_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)

            {

                if (editor.IsDropDownOpen == false)

                {

     

                    Dispatcher.BeginInvoke(new Action(() =>

                    {

                        editor.IsDropDownOpen = true;

                    }), System.Windows.Threading.DispatcherPriority.SystemIdle, null);

     

                }

                else if (editor.IsDropDownOpen == true)

                {

                    Dispatcher.BeginInvoke(new Action(() =>

                    {

                        editor.IsDropDownOpen = false;

                    }), System.Windows.Threading.DispatcherPriority.SystemIdle, null);

                }

          

            }

     

    If you need any further assitance on this matter, feel free to ask.