开发者

How to raise an attached event in wpf?

开发者 https://www.devze.com 2023-01-12 09:42 出处:网络
How can I 开发者_StackOverflow社区raise DataObject.Pastingevent from my code?You can raise any event on any UIElement using the RaiseEvent() method.Just create the appropriate event args for the handl

How can I 开发者_StackOverflow社区raise DataObject.Pasting event from my code?


You can raise any event on any UIElement using the RaiseEvent() method. Just create the appropriate event args for the handler and pass to RaiseEvent().

var args = new DataObjectPastingEventArgs(dataObject, isDragDrop, formatToApply)
{
    Source = this,
    RoutedEvent = DataObject.PastingEvent //set the event here
};
element.RaiseEvent(args);


You need to call RaiseEvent on the appropriate UIElement, passing in a RoutedEventArgs with RoutedEvent set to DataObject.Pasting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号