I want to change a GUI property in the OnChanged method... (in actuality im trying to set an image source.. but used a button here for simplicity). This is called everytime
I'm guessing that the FileSystemWatcher is calling your event handler on another thread. Inside your event handler, use your application's Dispatcher to marshal it back to the UI thread:
private void OnChanged(object source, FileSystemEventArgs e) {
Application.Current.Dispatcher.BeginInvoke(new Action(() => DoSomethingOnUiThread()));
}
private void DoSomethingOnUiThread() {
Test_Button.Width = 500;
}