有没有办法捕获ScrollViewer的以下事件
ScrollViewer.ScrollStarter="ScrollStarted"
ScrollViewer.ScrollCompleted="ScrollCompleted"
答案 0 :(得分:1)
我认为Silverlight中没有ScrollStarted
或ScrollEnded
等事件。但是,您可以创建Dependency Property
收听水平和垂直Offset
并使用此Dependecy Property
来触发自定义事件,指示用户是否滚动。
This link包含一个示例;
答案 1 :(得分:1)
我认为你应该尝试我的方式
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
}