I have a WPF application with a main window and a second window that can be opened from a button in the main window. I want the main window to be disabled while the second window is open as an "About" window in Visual Studio.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Try this
ShowDialog
method instead ofShow
to open the second window as a dialog.You have a WPF project already with a window. This app should work.
Right click on project and Add new Window. You name it Window1.xaml
You would now notice Window1.xaml and Window1.xaml.cs added to your project. (the class name for the window would be Window1 which is in the .xaml.cs file and it derives from Window; also a partial class)
Open the XAML file for the Window1 (Window1.xaml) and add your controls. Treat it like any other window and write code.
Now in your main window (the first one) you add a Button which when clicked should show the newly created window.
For that inside the Click handler, ....
This
Window1
should be the design for your About page. Invoking it withShowDialog();
disables the other windows and the only active window will be your about page.