有什么方法可以捕获 ScrollViewer 的以下事件
ScrollViewer.ScrollStarter="ScrollStarted"
ScrollViewer.ScrollCompleted="ScrollCompleted"
有什么方法可以捕获 ScrollViewer 的以下事件
ScrollViewer.ScrollStarter="ScrollStarted"
ScrollViewer.ScrollCompleted="ScrollCompleted"
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
}
我认为没有像ScrollStarted
或ScrollEnded
在silverlight这样的事件。但是您可以创建一个Dependency Property
监听 Horizontal 和 Vertical Offset
s 并使用它Dependecy Property
来触发一个自定义事件,指示用户是否滚动。
此链接包含一个示例;