user278618
user278618

Reputation: 20232

Minimize window from usercontrol in wpf

I want to minimize my window , when I open other window/

This is a method in my user control which is in another user control, which is in another user control too.

WindowUploadFiles windowUploadFiles=new WindowUploadFiles();
//Minimize() - how to ?
            windowUploadFiles.ShowDialog();
// Maximize() - how to ?

Has anybody experience with this problem ?

Upvotes: 4

Views: 5981

Answers (1)

Thomas Levesque
Thomas Levesque

Reputation: 292365

You can use the WindowState property to minimize/maximize/restore the window:

// Find the window that contains the control
Window window = Window.GetWindow(this);

// Minimize
window.WindowState = WindowState.Minimized;

// Restore
window.WindowState = WindowState.Normal;

Upvotes: 8

Related Questions