PreviewMouseDown event prevents ComboBox from opening

5 posts, 0 answers
  1. Jace
    Jace avatar
    9 posts
    Member since:
    Feb 2015

    Posted 16 May Link to this post

    Why would a PreviewMouseDown event prevent the ComboBox from opening?

     

    In using the snippet below and using that event (whether there is any code in the handler or not), the ComboBox will not open. Once the event reference is removed from XAML it works as expected.

    What am I missing here?

    <telerik:RadComboBox Height="23"
             Margin="12,20,12,0"
             VerticalAlignment="Top"
             DisplayMemberPath="LIST_NAME"
             IsEditable="True"
             IsFilteringEnabled="True"
             IsReadOnly="True"
             IsTabStop="True"
             IsTextSearchEnabled="True"
             ItemsSource="{Binding Path=ElementTypes}"
             OpenDropDownOnFocus="False"
             PreviewMouseDown="rcb_PreviewMouseDown"
             StaysOpenOnEdit="True"
             TextSearchMode="Contains" />
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 17 May Link to this post

    Hi John,

    I didn't manage to reproduce the reported behavior of RadComboBox - setting PreviewMouseDown event does not affect the opening of the dropdown.

    Could you confirm that you're using the latest R2 2016 release of UI for WPF? Can you send us some additional code, so we to be able to reproduce the issue at our side?

    Looking forward to your reply.

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jace
    Jace avatar
    9 posts
    Member since:
    Feb 2015

    Posted 17 May in reply to Yana Link to this post

    Thanks for the reply. I found the issue on my end; however, in trying to setup the ComboBox how my end customer wants it to function, I'm still having problems. I'm sure it's possible, but I can't find the right combination of properties and possible events.

    They do not want it to open on focus, but when it has focus they want it to open when they start typing and to be able to see what they are typing. They also want it to toggle from open to close if they click anywhere on the control. If they are typing and select an entry from either a mouse click or an enter key, it will close. Or by navigating away (lose focus) will close it also it.

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 May Link to this post

    Hello John,

    You could handle PreviewKeyDown event of the ComboBox and PreviewMouseDown event of the TextBox placed inside its template and open the DropDown in the events handlers. In order to subscribe to the events of the TextBox, you can use the TextBoxStyle property.

    I have attached a sample project based on the provided code and the additional requirements, please download it and give it a try.

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Jace
    Jace avatar
    9 posts
    Member since:
    Feb 2015

    Posted 18 May in reply to Yana Link to this post

    After implementing your solution in our project, it looks like this will work for us.

    Thanks and I appreciate your time.

Back to Top
UI for WPF is Visual Studio 2017 Ready