I also had a problem with this, and it seems that changing the visibility in the main window does not work as HB indicated. For my case, I didn’t want to show the window until it was fully loaded, and was able to achieve this using the property that I am associated with here, along with the Show () and Hide () functions in the Window object. System.Windows.Window.ShowActivated
- When the initialization of the window object does not set the visibility to hide, follow these steps instead
- Set the ShowActivated property to false
this.ShowActivated = false; - Call the Hide () function in the window object
this.Hide(); - A function from your original sample call to
this.Show(); loaded in your window this.Show();
It is also possible that some WPF applications for this link do not work as expected, however, if so, go to XAML and find the window name property. You should be able to update the window from the code using this name. Ex.
<Window x:Name="MainWindow"> //Code Behind Below MainWindow.ShowActivated = false;
source share