0

有什么方法可以捕获 ScrollViewer 的以下事件

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

2 回答 2

1

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
}
于 2013-01-31T09:01:34.967 回答
1

我认为没有像ScrollStartedScrollEnded在silverlight这样的事件。但是您可以创建一个Dependency Property监听 Horizo​​ntal 和 Vertical Offsets 并使用它Dependecy Property来触发一个自定义事件,指示用户是否滚动。

此链接包含一个示例;

于 2013-01-31T07:48:31.287 回答