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

Disabling combo scrolling in RadGridView

2 Answers 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 18 Apr 2016, 01:38 PM

Hi,

We have a situation where we have the RadGridView with ComboBoxes in two of its columns. There are two Text columns as well.

If the mouse is kept over a combo box column and the mouse scroll is used, the Grid scroll bar does not fire but the combo box changes selection. However if the mouse is kept above a Text column cell and the mouse scroll is used, the grid scroll bar works as usual. We don't want this disparity. We want the grid scroll bar to work even if the mouse is kept over the radcombobox column cell.

Another challenge is the version of Telerik.Windows.Controls.GridView.dll that we have in our project is 2011.1.0419.35.

I have tried to play with by hooking the OnPreviewMouseWheel event of the RadComboBox that resides in the grid cell. But seems it still makes the combo box scroll.

 

01.private void CboPreference_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
02.       {
03.           var comboBox = sender as RadComboBox;
04.           if (comboBox != null)
05.           {
06.               if (grdTraderPreferences != null)
07.               {
08.                   //Copy over event arg members and raise it
09.                   var newarg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
10.                   {
11.                       RoutedEvent = RadGridView.PreviewMouseWheelEvent,
12.                       Source = sender
13.                   };
15.                   grdTraderPreferences.RaiseEvent(newarg);
16.               }
17.           }
18.       }

Any help will be appreciated.

 

regards,

J

2 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 20 Apr 2016, 10:34 AM
Hello James,

RadComboBox has an IsMouseWheelEnabled property indicating whether the instance will respond to MouseWheel events when the dropdown is not open.

If you're using a custom CellEditTemplate with a RadComboBox in it, you can simply set this property to False.

If instead, you're using a GridViewComboBoxColumn, you can create a new EditorStyle for it, like so:

<Style TargetType="telerik:RadComboBox" x:Key="CustomEditorStyle">
    <Setter Property="IsMouseWheelEnabled" Value="False" />
</Style>
<telerik:GridViewComboBoxColumn EditorStyle="{StaticResource CustomEditorStyle}" />

Please let me know if this approach would work for you.

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
James
Top achievements
Rank 1
answered on 20 Apr 2016, 12:38 PM
That helped - Thanks!
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
James
Top achievements
Rank 1
Share this question
or