In m开发者_StackOverflow社区y application is required the user to select an item from a list before continues uses the application.
To do this, I have a window with the desired items and I display it when the MainWindow displays.
public MainWindow()
{
InitializeComponent();
var itemsWindow = new ItemsWindow();
itemsWindow.Show();
}
The problem is that the window opens in background. How can I open the window in foreground?
The preferable would be to open the itemsWindow on applications start up and onClose event of itemsWindow to display the mainWindow, but I think this approach is far away from my knowledge. Nevertheless, I would appreciate it if someone could post something for how to achieve this.
Thanks
Use ShowDialog()
method instead. That way, you won't have to worry about activating that window and user won't be able to interact with MainWindow
until ItemsWindow
has been closed.
Example:
var itemsWindow = new ItemsWindow();
itemsWindow.ShowDialog();
精彩评论