no mouse events for RadComboBox in RadWindow

1 Answer 41 Views
ComboBox Window
Peter
Top achievements
Rank 1
Iron
Peter asked on 27 Aug 2024, 11:10 PM

We were using a standard Window object as the parent for our MainWindow. All was good. Then we wanted to do theming...couldn't do it easily, we found we needed to change to telerik:RadWindow. That's when everything went.....bad. No more window icons, no more task bar icon, no more showing up in taskbar. We've been able to figure out msot things and add more code to "fix" what we thought should be part of the default behaviour.

Then this morning my boss uses the mouse to try to change a value in a RadComboBox.....nope. Huh? I must have done something wrong? I don't think so. The change is in git and linked to the exact date we changed from Window to RadWindow..

How are you supposed to get mouse selections to work with a RadComboBox contained in a RadWindow?

Stenly
Telerik team
commented on 28 Aug 2024, 07:23 AM

Could you share a sample project that reproduces this behavior? This way, I can test it based on the scenario on your end and provide more information on it.
Peter
Top achievements
Rank 1
Iron
commented on 28 Aug 2024, 01:50 PM

I can. Let me see what I can do.

My dilemma is,  I'm using telerik with nuget and environment variables. To setup a self contained and simple example, is going to take me much more time than I really care to deal with this issue.  I'm sorry, I just find these telerik controls frustrating. Why am I using them then? GREAT question! But my company says so. So off I go, IMHO, wasting time chasing things like this. Sorry, I'm frustrated and need to vent. This isn't my first time with a company dictating tool usage and being forced to deal with functional and integration issues.

Yes, yes, i know, I know. If i want to get help on this, I need the simple sample. I'll try to "whip" one up now.

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Top achievements
Rank 1
Iron
answered on 28 Aug 2024, 03:17 PM

I think I figured it out. Not nice. Certainly not expected.

When I'm using ItemsSource, everything is fine. But, when I'm using hard coded ComboBoxItems....nope, the mouse selection doesn't work. Sure I can change this to use ItemsSource (which I'll have to do now to make this work), but why is this borked in this way?

Stenly
Telerik team
commented on 28 Aug 2024, 03:29 PM

The RadComboBox control, when hosted in a RadWindow, works correctly with both the ItemsSource property (data-binding) and when defining RadComboBoxItem instances inside its Items collection. Additionally, its mouse events also work correctly.

I have attached a test application to showcase this. The RadComboBox is placed in a RadWindow with XAML-defined RadComboBoxItem instances, and on the PreviewMouseLeftButtonDown event of RadComboBox, a certain logic is executed to display that the mouse events are working.

To test the application, add the Xaml version of our assemblies. I will be awaiting your reply, in order to assist you further on this case.

Peter
Top achievements
Rank 1
Iron
commented on 28 Aug 2024, 05:45 PM

Ah! Yes, the RadCombBoxItem also works! Thank you for the option. I just tried your sample. Thank you. I had to install the telerik controls locally (I had removed them before cause I'm using nuget for my company project). A bit more work than I anticipated.

The thing I don't get is the way ComboBoxItem works....but only a bit. Telerik can do a lot...but not this? And it's only apparent upon manual testing (I haven't automated this yet).

Thank you for the sample to look at an poke around with. I'm using that to prove to me the ComboBoxItem doesn't work and the RadComboBoxItem does. Thank you.

Martin Ivanov
Telerik team
commented on 02 Sep 2024, 01:26 PM

The Telerik's RadComboBox control is designed to work with RadComboBoxItems. This is why the WPF native ComboBoxItem doesn't work as expected. This is a common concept in WPF and you can observe it also with ListBox and ListBoxItem, TabControl and TabItem, and others (including the Telerik's RAD alternatives).

This works partially with the ComboBoxItem because this is how the ItemControls in WPF work. If you add any visual element (TextBox, Button, ComboBoxItem, etc.) in the Items collection, this will be displayed, but automatically wrapped in the associated item container. In this case, that is the RadComboBoxItem. So, when you host ComboBoxItem elements in RadComboBox, you get a set of RadComboBoxItem elements with ComboBoxItem objects as their Content.

The selection doesn't work because the native ComboBox is handling the mouse event which cannot bubble up to the parent RadComboBoxItem and this way the selection in RadComboBox is prevented.

A small side note about this, I've tested it also with the native WPF Window control (instead of RadWindow) and the same behavior is observed.

Tags
ComboBox Window
Asked by
Peter
Top achievements
Rank 1
Iron
Answers by
Peter
Top achievements
Rank 1
Iron
Share this question
or