Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have multiple windows in one WPF Application?

Tags:

wpf

I'm relatively new to the WPF world and I'm working on an application where I need to have multiple windows in one application. Like Photoshop when the user clicks on "New" button a new window opens and the old existing window(s) goes in the background. The toolbar and the statusbar, however, stay on top, untouched. I would also like to add the feature that the user can work with multiple windows if each of them is not maximized. How do I achieve this? I apologize if I'm a bit unclear in framing my question.

like image 595
Prakhar Avatar asked Nov 03 '10 19:11

Prakhar


People also ask

Is WPF still relevant 2021?

It was in 2006 that Windows Presentation Foundation (WPF) was released with . NET framework 3.0. Over the years it got improved and it is still now in the market in 2021.

Is WPF harder than WinForms?

It is simple to use WinForms as controls can be used easily, it's less time-consuming and less tricky as compared to WPF. It has an inbuilt story boarding feature and animation model, it has the ability to use business objects in UI declaratively.

Is WPF multi platform?

WPF draws its own controls and does not use built-in Win32 GUI components. The user interface is typically defined in XAML, an XML language. WPF even went cross-platform, in a sense, when Microsoft introduced Silverlight, cut-down WPF for embedding in web pages, and then later for Windows Phone.

Which is faster WPF or WinForms?

Winforms vs WPF both are mainly used for the same purpose for developing and designing windows applications, but WPF can be used for the web application. The difference between them is scalability, performance as WPF can render fast compared to windows forms, complexity, and support.


1 Answers

What you are (probably) talking about is an MDI Application. "Unfortunately" WPF does not support that natively. I use quotes because it is more frowned upon in modern UI development than it was in the past.

Instead, the most common "WPF way" of doing this is to open each New window in a new tab in a tab control (like Visual Studio and most web browsers do).

If you really want to do an MDI application, Google search that, but to warn you, it probably means creating your own Window manager.

An alternative is to open non-modal windows, with their ShowInTaskbar property set to false. This gives you the ability to open as many windows as you want, but you lose the ability to contain them within a centralized workspace app.

like image 65
Wonko the Sane Avatar answered Sep 24 '22 17:09

Wonko the Sane