Scrolling your mouse wheel with Silverlight

Description

Tim Heuer found an interesting article by Adam Cooper on Silverlight and adding in support for your mouse's scroll wheel

To do so, it pretty painless with Adam's helper class.

XAML:

<ScrollViewer x:Name="MyScroller" Width="300" Height="100" Background="AliceBlue">
    <TextBlock TextWrapping="Wrap">
        Even if you use my workaround ...
    </TextBlock>
</ScrollViewer>

Page.xaml.cs example:

using Cooper.Silverlight.Controls;

public Page()
{
    InitializeComponent();
    ScrollViewerMouseWheelSupport.Initialize(this);
    MyScroller.AddMouseWheelSupport();
}

Adam has a few working demos, this one is showing off the scrollbar where the mouse is hovering over the needed scroll area.

image

Tag:

C4FNews

The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.