65.9K
CodeProject is changing. Read more.
Home

Silverlight Smooth Scrolling

starIconstarIconstarIconstarIconemptyStarIcon

4.00/5 (1 vote)

Oct 29, 2012

CPOL
viewsIcon

8250

downloadIcon

271

Making Scrolling smooth in Silverlight Itempresenter

Introduction

By default, Silverlight Scrollviewer skips the entire item when it comes to scrolling.But we can make it scroll smooth.In various situations, depending upon the User Experience of our Silverlight application, we want to make a smooth move between the items.

Gallery

Using the Code

Microsoft Expression blend sdk has something for you. 

Microsoft.Expression.Interactivity has a FluidMoveBehavior can be easily used inside the listbox control template to achieve the target.

 <ScrollViewer x:Name="ScrollViewer" BorderBrush="Transparent" BorderThickness="0" 
      Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" 
      TabNavigation="{TemplateBinding TabNavigation}" 
      Style="{StaticResource ListBoxScrollViewerStyle}">
                <ItemsPresenter>
                                    <i:Interaction.Behaviors>
                                        <ei:FluidMoveBehavior x:Name="FluidMoveBehavior"/>
                                    </i:Interaction.Behaviors>
                </ItemsPresenter>
  </ScrollViewer>

To do this we need to add two assemblies Microsoft.Expression.Interactions.dll and System.Windows.Interactivity.dll

To learn more about FluidMoveBehavior visit :

http://msdn.microsoft.com/en-us/library/ff723946(v=expression.40).aspx