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

Hook in mouse wheel behaviours on Mac

3 Answers 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John Harrison
Top achievements
Rank 1
John Harrison asked on 03 Nov 2014, 11:30 AM
Hi,

On macs we have to manually put a html bridge in to get mouse wheel scrolling to work:

http://www.aymericlagier.com/en/2011/06/17/silverlight-how-to-use-mouse-wheel-on-silverlight-and-chrome-when-windowless-is-enabled/

Is there a simple way to get telerik controls have this behaviour via a style?

We need it to work for RadComboBox, RadListBox, RadPropertyGrid etc.

Unfortunately I cannot easily see how to get the ScrollViewer from these controls to do it automatically without manually having to wire in every single control.

Any suggestions or help would be welcome.

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 06 Nov 2014, 09:19 AM
Hello John,

We haven't tested this approach with our controls, however, in order to access the used ScrollViewers inside them, you will need to extract their Control Templates as explained in the following topic:
Editing Control Templates

For RadComboBox, for example, you will have to extract the EditableComboBox and NonEditableComboBox ( used according to the IsEditable value), find in them the ScrollViewer with Key set to "PART_ScrollViewer" and apply the needed behavior to it.

Please note that the we strongly recommend using Implicit Styles ( and NoXaml assemblies) in the application as this makes such customizations easier.

Hope this will help get started.

Regards,
Yana
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
John Harrison
Top achievements
Rank 1
answered on 06 Nov 2014, 10:50 AM
Hi,

I've tried that with both of the following:

<Style TargetType="telerik:RadComboBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadComboBox">
                    <Border x:Name="PART_ResizeBorder">
                        <i:Interaction.Behaviors>
                            <behaviors:MouseWheelScrollBehavior/>
                        </i:Interaction.Behaviors>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="telerik:RadComboBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadComboBox">
                    <ScrollViewer>
                        <i:Interaction.Behaviors>
                            <behaviors:MouseWheelScrollBehavior/>
                        </i:Interaction.Behaviors>
                        <ItemsPresenter/>
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

And while we have success in hooking into the scroll control, unfortunately we do not get any mouse enter/leave got/lost focus events.

These are required so we know we are over the actual scrollviewer in question, otherwise messages go to all scrollviewers.

We are hooking into the events for the UIElement.

Any ideas how we can solve this?

Thanks
0
Yana
Telerik team
answered on 10 Nov 2014, 09:43 AM
Hello John,

As I explained in the previous post, you will need to extract the whole ControlTemplate of the needed controls, find the ScrollViewer inside and attach the behavior to it, there is no easy solution as in the regular MS ListBox as the used templates are more complicated.

I have attached a simple project with RadComboBox, please download it and give it a try. Note that you should use NoXaml assemblies ( from Binaries.NoXaml in your installation folder).

I hope this will be helpful.

Regards,
Yana
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
John Harrison
Top achievements
Rank 1
Answers by
Yana
Telerik team
John Harrison
Top achievements
Rank 1
Share this question
or