Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有时自定义加载弹出窗口不会';不显示_C#_.net_Wpf_User Interface_Loading - Fatal编程技术网

C# 有时自定义加载弹出窗口不会';不显示

C# 有时自定义加载弹出窗口不会';不显示,c#,.net,wpf,user-interface,loading,C#,.net,Wpf,User Interface,Loading,在我的应用程序中,每次调用时都会显示加载弹出窗口。但有些时候,它只是不显示,这是相同的情况。Popup是使用WPF创建的自定义UserControl对象 弹出窗口位于主窗口中。xaml: <Viewbox Stretch="Fill"> <Grid> <Grid x:Name="Body" Height="768" Width="1024" Background="{StaticResource SCBPassiveCol

在我的应用程序中,每次调用时都会显示加载弹出窗口。但有些时候,它只是不显示,这是相同的情况。Popup是使用WPF创建的自定义UserControl对象

弹出窗口位于主窗口中。xaml:

<Viewbox Stretch="Fill">
    <Grid>          
        <Grid x:Name="Body" Height="768" Width="1024" Background="{StaticResource SCBPassiveColor}" />
        <src:InfoPane x:Name="InfoPaneMaster"  Visibility="Collapsed" VerticalAlignment="Top" HorizontalAlignment="Center" />
    </Grid>
</Viewbox>
public void DisplayInfoPane(string infoText, ROPInfo infoType, int? displayTime)
{
    StopTimer();
    SetTimer(displayTime ?? DefaultDisplayTime);
    PrepareInfoPane(infoText, infoType);
    colCloseIcon.Width = new GridLength(0);
    this.Visibility = Visibility.Visible;
}
实施:

<Viewbox Stretch="Fill">
    <Grid>          
        <Grid x:Name="Body" Height="768" Width="1024" Background="{StaticResource SCBPassiveColor}" />
        <src:InfoPane x:Name="InfoPaneMaster"  Visibility="Collapsed" VerticalAlignment="Top" HorizontalAlignment="Center" />
    </Grid>
</Viewbox>
public void DisplayInfoPane(string infoText, ROPInfo infoType, int? displayTime)
{
    StopTimer();
    SetTimer(displayTime ?? DefaultDisplayTime);
    PrepareInfoPane(infoText, infoType);
    colCloseIcon.Width = new GridLength(0);
    this.Visibility = Visibility.Visible;
}
默认时间过后,弹出窗口将自动关闭(将可见性设置为折叠)


为什么有时候这个弹出窗口不显示?这与渲染有关吗?

胡乱猜测:如果计时器在另一个弹出窗口打开后刚好结束,那么它的可见性没有时间设置为可见。我试试你的想法。通常最简单的解决方案是正确的。