Scrolling your mouse wheel with Silverlight

Sign in to queue

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

Add Your 2 Cents