admin管理员组文章数量:1125586
I am trying to implement a loading window to my WPF project, but running into an issue with hiding it after first use and then showing it again when needed. The window works fine after first Show(), after Hide() and second Show(), the window is completely blank and nothing is showed. After all work is done, the loading window then loads its contents, but at this point the loading job is already done and I want to hide the window again. Could this be an threading issue, what am I missing? I am confused, because after the first show everything is fine...
The App.xaml.cs looks like this, comments showing what i want to do at certain steps:
namespace WpfApp1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
var _Window = new LoadingWindow();
// Everything fine here
_Window.Show();
// Do Loading work here
// Hide Window to show AuthenticationWindow
_Window.Hide();
// Ask for password here
// Loading Window doesn't show image and is completely blank
_Window.Show();
// Do some other loading before showing MainWindow
_Window.Hide();
}
}
}
The app.xaml looks like this:
<Application x:Class="WpfApp1.App"
xmlns=";
xmlns:x=";
xmlns:local="clr-namespace:WpfApp1"
Startup="Application_Startup">
<Application.Resources>
</Application.Resources>
</Application>
Loading window looks like this:
using System.Windows;
namespace WpfApp1
{
/// <summary>
/// Interaktionslogik für LoadingWindow.xaml
/// </summary>
public partial class LoadingWindow : Window
{
public LoadingWindow()
{
InitializeComponent();
}
}
}
And its XAML:
<Window x:Class="WpfApp1.LoadingWindow"
xmlns=";
xmlns:x=";
xmlns:d=";
xmlns:mc=";
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="LoadingWindow" Height="450" Width="800" Topmost="True">
<Grid>
<Image Source="/Icons/windows.png"></Image>
</Grid>
</Window>
The image showed inside the loading window has the following properties: Properties windows.png
本文标签: C WPF Window shows nothing after Hide()Stack Overflow
版权声明:本文标题:C# WPF Window shows nothing after Hide() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736666834a1946710.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论