throop77
throop77

Reputation: 827

Need to mirror/duplicate a window in a another window under WPF

I have an application where I've just recently discovered will also have to run in a mirrored window at a completely different resolution.

This link describes how multiple windows can each have different UI threads

I think my windows will need to run on different UI threads for performance reasons. So, now I need to mirror the viewable area of one window on another window. I have tried to set the DataContext of the second window to the first window but that causes an exception since they are different threads (a modified version of the above link).

        Thread thread = new Thread(() =>
        {
            MainWindow w = new MainWindow();
            w.DataContext = MainWindow.DataContextProperty;
            w.Show();

            w.Closed += (sender2, e2) =>
             w.Dispatcher.InvokeShutdown();

            System.Windows.Threading.Dispatcher.Run();
        });

        thread.SetApartmentState(ApartmentState.STA);
        thread.Start();

Any ideas?

Upvotes: 0

Views: 1925

Answers (1)

LPL
LPL

Reputation: 17083

Maybe it's better to Paint an Area with a Visual ?

Take a look at WPF Binding a visual brush's visual to a different window too.

Upvotes: 1

Related Questions