How can I raise DataObject.Pasting event from my code?
+1
A:
You need to call RaiseEvent on the appropriate UIElement, passing in a RoutedEventArgs with RoutedEvent set to DataObject.Pasting.
Phil Devaney
2010-08-19 07:53:17
thanks but i can accept only one correct answer.
Rohit
2010-08-19 08:34:57
+2
A:
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);
Jeff M
2010-08-19 07:53:51