Assuming you want to switch the window to a modeless one from the "master" window, you can do something like this, making Window1 become modeless after 5 seconds.
The disadvantage of this approach is that the dialogue will flicker.
private Window1 myWindow = new Window1();
private void MyButton_Click(object sender, RoutedEventArgs e)
{
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
dispatcherTimer.Start();
myWindow.ShowDialog();
}
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
(sender as DispatcherTimer).Stop();
myWindow.Hide();
myWindow.Show();
}
If you want to switch the window to a modeless one from the window itself, then calling Hide (), followed by Show (), will do the same thing (again with flickering)
private void SwitchToModelessButton_Click(object sender, RoutedEventArgs e)
{
this.Hide();
this.Show();
}
, 'master', ShowDialog(), , .