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

DropDownList MouseWheel Behavior in C# Outlook VSTO Add-in

11 Answers 273 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
reed
Top achievements
Rank 1
reed asked on 30 Apr 2018, 05:22 AM

I have a C# Outlook VTSO Add-in project that has issue regarding the behavior of the comboboxcolumn in a datagrid when using the mousewheel. The item just jumps to the first or last item when scrolling using the mousewheel, and also when pressing the up or down arrow while the dropdownlist is visible.

I tried to replicate the issue on a new Telerik C# Windows Forms Application but it seems that the issue only exist for C# Outlook VTSO Add-in projects. What I did was to add a dropdownlist and add more than 20 items and tried scrolling using the mouse wheel on both win form app and vtso addin. The issue only exist on the vtso addin.

Are there any workarounds about this?

Attached here are screen capture of outlook vtso addin and another for telerik windows form.

11 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 30 Apr 2018, 12:58 PM
Hello Reed,

Thank you for writing.

I tested a similar setup and the drop-down editor of the GridViewComboBoxColumn behaved correctly in my sample project. For reference, I am attaching it to the thread as well as a short video showing the result on my end.

In your video, I see that there is a certain delay while opening the popup. Please note that COM/ActiveX projects and Outlook add-ins are having a different application lifecycle and message loop compared to a standard .NET application. In such scenarios it possible to observe certain differences compared to a standard .NET project. Regarding your actual setup, disabling the animations might help so you can set the static AllowAnimations property to false: 
ThemeResolutionService.AllowAnimations = false;

I hope this helps. Let me know if you have other questions.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
reed
Top achievements
Rank 1
answered on 16 May 2018, 01:45 AM

Hi Hristo,

Thank you for replying.

I downloaded the project you attached and tried your setup. It seems the issue still persist on my side. I also tried to set the static AllowAnimations property to false on my setup and the actual project, but the issue is not resolved. Does this have something to do with the telerik version?

I attached the screenshot of the version of my setup here.

0
Hristo
Telerik team
answered on 16 May 2018, 03:18 PM
Hello Reed,

The version of the suite does not appear to be related as I have tested the 2016 dlls as well as the latest ones. I am not able to observe the reported on your end behavior. Please note, that Office add-ins are having a different application lifecycle and message loops compared to standard .NET applications. In this respect, there might be differences when you use the controls in add-ins.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
reed
Top achievements
Rank 1
answered on 25 May 2018, 04:49 AM
Hi Hristo,

If Office add-ins are having a different application lifecycle and message loops compared to standard .NET applications, and the "possibility" of differences when i used the controls in add-ins, how come you can not replicate the issue and in my end the issue still persist even if i downloaded and tried your sample project? What are the possibilities that the same projects does not have the same behavior? Have you tried replicating the issue without disabling the animations? Because I tried the sample project that you attached in your previous post in this thread and in my end the issue still persist.
0
Accepted
Hristo
Telerik team
answered on 28 May 2018, 12:17 PM
Hi Reed,

Before sending you the project I tested it with and without the animations. The behavior on my end is the same and the drop-down list can be scrolled one item at a time. Can you please try installing the add-in on a different system? The issue might be Office or machine related. There is not much that can be done on our end. We do not have code specifically handling add-in scenarios.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
reed
Top achievements
Rank 1
answered on 01 Jun 2018, 02:30 AM

Hi Hristo,

 

Before posting to Telerik Forums our QA team verified that the issue persist in their machine. 

Thank you for that. I guess the only option and work around we could do is to use DataGridView instead of Telerik RadGridView.

 

Regards,

Reed

0
Hristo
Telerik team
answered on 01 Jun 2018, 08:08 AM
Hi Reed,

Thank you for writing back.

As we are not able to reproduce the reported behavior it is really hard to determine its actual cause. We also do not have control over the add-in scenario and the Outlook environment so indeed there is not much that we can do on our end. 

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
David
Top achievements
Rank 1
answered on 03 Feb 2020, 10:07 PM

I'm experiencing the exact behavior as the original poster. The mouse wheel causes scrolling to jump to the end of the list or to the top of the list when using the RadDropDownList, as well as the RadCheckedDropDownList, within an Office add-in. Was there any solution found for this issue?

Or is there a way to override the mouse wheel event for the dropdownlist element and simulate it in code?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Feb 2020, 02:03 PM
 

Hello, David,   

Please note that as my colleague, Hristo, previously noted, COM/ActiveX projects and Outlook add-ins are having a different application life-cycle and message loop compared to a standard .NET application. In such scenarios it is possible to observe certain differences compared to a standard .NET project. Please note that we do not test our controls in such an environment and we do not guarantee normal work of the controls.

Have you tried the suggested solution with disabling the animation? Is the scrolling problem still reproducible?

According to the provided information, I am not sure whether you use the drop down list in RadGridView as an editor or as a separate control. However, in both cases you may use a similar approach for preventing the mouse wheel behavior.

RadGridView uses a RadDropDownListEditor for the combo columns. In order to disable scrolling the items in the popup, it is necessary to return true in the DropDownPopupForm.OnMouseWheel event. However, you will still be able to scroll the editable part in RadDropDownList. This can be stopped by overriding the RadDropDownListEditorElement.OnMouseWheel event and leaving the method empty. Then replace the default editor with the custom one in the EditorRequired event: https://docs.telerik.com/devtools/winforms/controls/gridview/editors/using-custom-editors

 public class CustomRadDropDownListEditor : RadDropDownListEditor
        {
            protected override RadElement CreateEditorElement()
            {
                return new CustomRadDropDownListEditorElement();
            }
        }

        public class CustomRadDropDownListEditorElement : RadDropDownListEditorElement
        {
            protected override RadPopupControlBase CreatePopupForm()
            {
                this.Popup = new CustomDropDownPopupForm(this);
                return Popup;
            }
            protected override void OnMouseWheel(MouseEventArgs e)
            {
 
            }
        }

        public class CustomDropDownPopupForm : DropDownPopupForm
        { 
            public CustomDropDownPopupForm(RadDropDownListElement ownerDropDownListElement) 
                : base(ownerDropDownListElement)
            {
            }

            public override bool OnMouseWheel(Control target, int delta)
            {
                return true;
            }
        }

For RadDropDownList, you can stop the default mouse wheel logic and implement your own as follows:

        public class CustomDropDownList : RadDropDownList
        {
            public override string ThemeClassName
            {
                get
                {
                    return typeof(RadDropDownList).FullName;
                }
            }

            protected override RadDropDownListElement CreateDropDownListElement()
            {
                return new CustomRadDropDownListElement();
            }
        }

        public class CustomRadDropDownListElement : RadDropDownListElement
        {
            protected override Type ThemeEffectiveType
            {
                get
                {
                    return typeof(RadDropDownListElement);
                }
            }

            protected override void OnMouseWheel(MouseEventArgs e)
            { 
            }

            protected override RadPopupControlBase CreatePopupForm()
            {
                this.Popup = new CustomDropDownPopupForm(this);
                return Popup;
            }
        }

        public class CustomDropDownPopupForm : DropDownPopupForm
        {
            public CustomDropDownPopupForm(RadDropDownListElement ownerDropDownListElement) : base(ownerDropDownListElement)
            {
            }

            public override bool OnMouseWheel(Control target, int delta)
            {
                return true;
            }
        }

If you are still experiencing any further difficulties, feel free to submit a support ticket from your account and provide a sample project demonstrating the undesired behavior hat you are facing. Thus, we would be able to make an adequate analysis of the precise case and provide further assistance. Thank you in advance.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
answered on 04 Feb 2020, 08:25 PM

Hi Dess,

Thanks for your reply. I did try disabling the animation, but that didn't help. I finally pin-pointed the issue and have implemented a workaround until this issue can be fixed. It seems the OnMouseWheel event is being fired 3x for each mouse wheel delta turn event the mouse driver sends. So, if the mouse driver sends three deltas per notch, then each delta event is in turn multiplied by 3, thus raising a total of 9 OnMouseWheel events in rapid succession, causing the list to jump much further than it should. My solution was to reduce these back down to one event that gets passed-through per three events that are actually raised. Here is my code which does that, and I have attached a screenshot of all the classes used, similar to your examples above:

 

class TwDropDownPopupForm : DropDownPopupForm
{
private const int EventsPerDelta = 3;
private int eventCounter = 0;

public TwDropDownPopupForm(RadDropDownListElement ownerDropDownListElement) : base(ownerDropDownListElement)
{
}

/* 
* This override is necessary because of a mouse wheel scrolling issue with this Telerik element
* within an Office add-in host environment. The issue is that three OnMouseWheel events are
* fired in rapid succession per mouse wheel notch (delta). So, if the mouse driver raises three
* mouse wheel deltas, then each is multiplied by three events making a total of 9 OnMouseWheel 
* events being fired in rapid succession. The code below will reduce it back down to just one
* event that gets passed-through per three that are raised.
*/
public override bool OnMouseWheel(Control target, int delta)
{
if (++eventCounter / EventsPerDelta == 1)
{
eventCounter = 0;
return base.OnMouseWheel(target, delta); ;
}
return true;
}
}

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Feb 2020, 01:31 PM

Hello, David,   

I am glad that you have found a suitable solution for your scenario.

The different environment (Office Add-in) doesn't guarantee that the same number of MouseWheel messages will be received in RadDropDownList. Hence, the obtained behavior.

We already have a similar issue logged in our logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link  : https://feedback.telerik.com/winforms/1370581-fix-raddropdownlist-scrolling-with-the-mousewheel-or-down-arrow-key-jumps-from-the-first-to-the-last-item-in-word-add-in-when-the-popup-is-opened 

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DropDownList
Asked by
reed
Top achievements
Rank 1
Answers by
Hristo
Telerik team
reed
Top achievements
Rank 1
David
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or