Multi-window instance:
1. How to customize the window program you want to start in the case of multiple Windows
1<application x:class="toolbar. APP"2xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"3xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"4Startupuri="MainWindow.xaml">5<Application.Resources>6 7</Application.Resources>8</Application>
App.xaml
You can Modify the name of the window you want to launch by startupuri= "MainWindow.xaml"
2. Fixed window size, no modification
Resizemode= "Noresize"
3. Where the dialog box pops up on the screen
windowstartuplocation= "Centerscreen"
4. Modify window name
Title= "About"
5. Maximize Window
Windowstate= "Maximized"
6. To pass a value to a dialog box
The window is actually a class
Public Partial class Aboutwindow:window
So that we can define a public property in the class to receive the value, before the new instance
Pass the value to the attribute in this class, and finally the load event in the child window to accept
Public Partial class Aboutwindow:window { publicstringgetset;} Public string Get Set ; } ...
Main Window
usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.Media.Imaging;usingSystem.Windows.Navigation;usingSystem.Windows.Shapes;namespacetoolbar{/// <summary> ///the interactive logic of MainWindow.xaml/// </summary> Public Partial classMainwindow:window { PublicMainWindow () {InitializeComponent (); } Private voidButton_click_1 (Objectsender, RoutedEventArgs e) { stringt =TX. Text; Aboutwindow Aboutwin=NewAboutwindow (); Aboutwin.username=T; Aboutwin.showdialog (); MessageBox.Show (ABOUTWIN.PWD); } }}
child window
Private void Window_loaded_1 (object sender, RoutedEventArgs e) { = UserName; }
7. child window return Properties
Whether the child window is passed to the main window or the master . To . The sub-values are passed through the property
8.OpenFileDialog
Public Partial classMainwindow:window { PublicMainWindow () {InitializeComponent (); } Private voidButton_click_1 (Objectsender, RoutedEventArgs e) {OpenFileDialog file=NewOpenFileDialog (); //file FilterFile. Filter ="text Files |*.txt| PNG image |*.png| Video |*.avi"; File. ShowDialog (); } }
Weekend charge of WPF (Iv.). Working between multiple windows