开发者

ContentControl render bug when using custom splash screen .Close() - what is going on?

开发者 https://www.devze.com 2022-12-16 20:55 出处:网络
I use a pretty basic ContentControl switching between different types of content: <ContentControl Content=\"{Binding MyContent}\">

I use a pretty basic ContentControl switching between different types of content:

<ContentControl Content="{Binding MyContent}">
    <ContentControl.Resources>
        <DataTemplate DataType="{x:Type local:Type1}">
            <local:View1/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type local:Type2}">
            <local:View2/>
        </DataTemplate>
...
    </ContentControl.Resources>
</ContentControl>

Randomly (like 20% of all runs), when a view is displayed, it displays completely transparent, but does not allow controls behind it to receive input.

If I try to use Snoop on the window, the view instantly renders. The view is even takes input and changes the mouse cursor when I hover over expected-to-be text boxes. If I press any button on the "invisible" view, it instantly pops up.

Switching from ContentControl to ContentPresenter did not change the above behavior.

Does anybody have a clue what is going on and how to fix it?

EDIT: It looks like a bug in WPF, so my best hope is somebody who have experienced this problem.

EDIT: I tracked it down t开发者_如何学运维o the custom splash screen window, being exact - to using .Close() to get rid of the window. If I use .Hide() instead, the glitch does not happen. Still not getting why.

0

精彩评论

暂无评论...
验证码 换一张
取 消