Inside MainWindow.xaml.cs i tried this
fsw.SynchronizingObject = (System.ComponentModel.ISynchronizeInvoke)this;
but getting exception :
System.InvalidCastException: 'Unable to cast object of type 'WPF_Test.MainWindow' to type 'System.ComponentModel.ISynchronizeInvoke'.'
just using this in the end of the line
fsw.SynchronizingObject = this;
give the error
cannot convert from mainwindow to ISynchronizeInvoke
but then when trying to cast it's giving me the exception on the top.