Faizan
Faizan

Reputation: 776

ScrollViewer Scrolling Event

is there any way to catch the following Events for ScrollViewer

ScrollViewer.ScrollStarter="ScrollStarted"
ScrollViewer.ScrollCompleted="ScrollCompleted"

Upvotes: 0

Views: 826

Answers (2)

Jignesh.Raj
Jignesh.Raj

Reputation: 5987

I Think You Should Try My Way

public static class ScrollViewerBinding
{
  #region VerticalOffset attached property

  /// <summary>
  /// Gets the vertical offset value
  /// </summary>
  public static double GetVerticalOffset(DependencyObject depObj)
  {
    return (double)depObj.GetValue(VerticalOffsetProperty);
  }

  /// <summary>
  /// Sets the vertical offset value
  /// </summary>
  public static void SetVerticalOffset(DependencyObject depObj, double value)
  {
    depObj.SetValue(VerticalOffsetProperty, value);
  }

  /// <summary>
  /// VerticalOffset attached property
  /// </summary>
  public static readonly DependencyProperty VerticalOffsetProperty =
      DependencyProperty.RegisterAttached("VerticalOffset", typeof(double),
      typeof(ScrollViewerBinding), 
    new PropertyMetadata(0.0, OnVerticalOffsetPropertyChanged));

  #endregion
}

Upvotes: 1

daryal
daryal

Reputation: 14919

I think there are no events like ScrollStarted or ScrollEnded in silverlight. But you may create a Dependency Property listening the Horizontal and Vertical Offsets and use this Dependecy Property to fire a custom event indicating whether whether user scrolls or not.

This link includes a sample;

Upvotes: 1

Related Questions