Finally, I solved this problem i was doing Window imgWindow = new ImageWindow(); instead of var imgWindow = new ImageWindow();


Maybe that will help someone else in the future.