开发者

How to raise an attached event in wpf?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜