定义拖起前与放置前的事件

This commit is contained in:
zengwenjie
2025-09-18 16:55:14 +08:00
parent dd4cf22db8
commit ed1f451121

View File

@@ -975,6 +975,56 @@ namespace Deedy.Activity
// 事件触发前可以进行一定的处理逻辑
RaiseEvent(args);
}
/// <summary>
/// 准备拖动
/// </summary>
/// <remarks>
/// 在对象被拖动之前发生,可以被取消
/// </remarks>
public static readonly RoutedEvent PreviewActionDragEvent = EventManager.RegisterRoutedEvent("ActionDrag", RoutingStrategy.Tunnel,
typeof(EventHandler<CancelRoutedEventArgs>), typeof(ActionViewer));
/// <summary>
/// 事件「准备拖动」封装
/// </summary>
public event EventHandler<CancelRoutedEventArgs> PreviewActionDrag
{
add { AddHandler(PreviewActionDragEvent, value); }
remove { RemoveHandler(PreviewActionDragEvent, value); }
}
/// <summary>
/// 事件「准备拖动」触发
/// </summary>
/// <param name="args">事件参数</param>
protected virtual void RaiseEvent_PreviewActionDrag(CancelRoutedEventArgs args)
{
// 事件触发前可以进行一定的处理逻辑
RaiseEvent(args);
}
/// <summary>
/// 准备放置
/// </summary>
/// <remarks>
/// 在对象被放置之前发生,可以被取消
/// </remarks>
public static readonly RoutedEvent PreviewActionDropEvent = EventManager.RegisterRoutedEvent("ActionDrop", RoutingStrategy.Tunnel,
typeof(EventHandler<CancelRoutedEventArgs>), typeof(ActionViewer));
/// <summary>
/// 事件「准备放置」封装
/// </summary>
public event EventHandler<CancelRoutedEventArgs> PreviewActionDrop
{
add { AddHandler(PreviewActionDropEvent, value); }
remove { RemoveHandler(PreviewActionDropEvent, value); }
}
/// <summary>
/// 事件「准备放置」触发
/// </summary>
/// <param name="args">事件参数</param>
protected virtual void RaiseEvent_PreviewActionDrop(CancelRoutedEventArgs args)
{
// 事件触发前可以进行一定的处理逻辑
RaiseEvent(args);
}
#endregion
}
}