Hi All,
I have this problem that My WPF App in its MainWindow.
I am trying to call the below wrapevent in my window.
__browseInput.Click += MainModule.WrapEvent(__browse_Click).EventHandler;
And i am implementing the wrapping functionality in another class.This class is dependent for class for my window.The code is below
public static EventInvoker WrapEvent(EventHandler handler) where TEventArgs : EventArgs
{
if (_eventWrapper == null)
{
_eventWrapper = new EventWrapper();
_eventWrapper.CaughtException += ShowUnhandledException;
}
if (_eventWrapper.Sync == null && _mainForm != null)
{
_eventWrapper.Sync =(ISynchronizeInvoke) _mainForm;
}
return _eventWrapper.Wrap(handler);
}
In this _eventWrapper.Sync =(ISynchronizeInvoke) _mainForm; i am getting the error.
Could you please provide solution to me.
What I have tried:
I was tried using
Dispatcher.BeginInvoke
,But it's not working.