I need help on WPF...
When user move/drag/change the position of the 1st page window (mainwindow.xaml), then user click on "next" button to proceed to 2nd page(process.xaml), the window (process.xaml) is not at the same position as the (mainwindow.xaml) that the user move to earlier on. How can I make it to remember the position of t开发者_JS百科he window throughout? And when user close the window, and run it again, the window will be default appear in the center unless user move the window.
Really need help for this. Thanks.
Maybe it would be easiest to only have one window throughout the whole application, but replace the window's contents? Create your screens as usercontrols instead, then set content on the main window instead of opening a new one..
You might want to make use of the WindowStartupLocation for process.xaml.
Setting WindowStartupLocation to Manual causes a window to be positioned according to its Left and Top property values. If either the Left or Top properties aren't specified, their values are determined by Windows.
Like this:
this.Owner = MainWindow; // reference to mainwindow.xaml
this.Left = Owner.Left;
this.Top = Owner.Top;
this.WindowStartupLocation = WindowStartupLocation.Manual;
精彩评论