用户控件淡入会导致白色闪烁

时间:2014-09-21 11:01:28

标签: wpf xaml

我正在使用XAML淡化其Load事件的用户控件。这会在不透明度增量开始之前产生白色闪光。这是XAML代码。

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="UserControl1"
    x:Name="UserControl"
    d:DesignWidth="640" d:DesignHeight="480" Opacity="0">
        <UserControl.Triggers>
            <EventTrigger RoutedEvent="UserControl.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UserControl.Opacity)"
                                         From="0"
                                         To="1"
                                         Duration="0:0:1"/>
                    </Storyboard>
                </BeginStoryboard>  
            </EventTrigger>
        </UserControl.Triggers>
        <UserControl.Background>
            <ImageBrush ImageSource="406-bubble.jpg"/>
        </UserControl.Background>
</UserControl>

我已经检查了一些以前的答案,但这些线程中提到的解决方案似乎没有用。非常感谢任何帮助。

0 个答案:

没有答案
相关问题