Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimize window from usercontrol in wpf

Tags:

c#

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 ?

like image 374
user278618 Avatar asked Feb 26 '23 05:02

user278618


1 Answers

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;
like image 108
Thomas Levesque Avatar answered Mar 11 '23 06:03

Thomas Levesque