Hook in mouse wheel behaviours on Mac

4 posts, 0 answers
  1. John Harrison
    John Harrison avatar
    23 posts
    Member since:
    May 2010

    Posted 03 Nov 2014 Link to this post

    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.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 06 Nov 2014 Link to this post

    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.

     
  3. DevCraft banner
  4. John Harrison
    John Harrison avatar
    23 posts
    Member since:
    May 2010

    Posted 06 Nov 2014 in reply to Yana Link to this post

    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
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Nov 2014 Link to this post

    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.

     
Back to Top