有没有办法为ScrollViewer捕获以下事件
ScrollViewer.ScrollStarter="ScrollStarted"
ScrollViewer.ScrollCompleted="ScrollCompleted"发布于 2013-01-31 15:48:31
我认为在silverlight中没有像ScrollStarted或ScrollEnded这样的事件。但您可以创建一个侦听水平和垂直Offset的Dependency Property,并使用此Dependecy Property触发一个自定义事件,以指示用户是否滚动。
This link包含一个示例;
发布于 2013-01-31 17:01:35
我觉得你应该试试我的方法
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
}https://stackoverflow.com/questions/14620593
复制相似问题