This is a migrated thread and some comments may be shown as answers.

PreviewMouseDown event prevents ComboBox from opening

4 Answers 479 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jace
Top achievements
Rank 1
Jace asked on 16 May 2016, 05:53 PM
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" />

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 May 2016, 12:20 PM
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.
0
Jace
Top achievements
Rank 1
answered on 17 May 2016, 07:25 PM

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.

0
Yana
Telerik team
answered on 18 May 2016, 10:34 AM
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.
0
Jace
Top achievements
Rank 1
answered on 19 May 2016, 03:15 AM

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

Thanks and I appreciate your time.

Tags
ComboBox
Asked by
Jace
Top achievements
Rank 1
Answers by
Yana
Telerik team
Jace
Top achievements
Rank 1
Share this question
or