简体   繁体   English

Xaml故事板动画不触发

[英]Xaml Storyboard Animation not firing

I am trying to fix a UI that had an animation previously. 我正在尝试修复以前具有动画的UI。 It had a Picture that rendered on the interface when the app is loaded. 加载应用程序时,它具有在界面上呈现的图片。 I am having a tough time trying to get over the learning curve of XAML. 我很难度过XAML的学习过程。 Also if someone has a resource where I can better learn XAML I would really appreciate it. 另外,如果有人拥有可以更好地学习XAML的资源,我也将不胜感激。 The issues is nothing shows the image does not render on start and there is not animation as far as I can tell. 问题是什么都没有显示图像在开始时无法渲染,而且据我所知没有动画。

<Image x:Name="T_Image" 
       HorizontalAlignment="Left" 
       Height="300" 
       VerticalAlignment="Top" 
       Width="300" 
       Source="Resources/Picture.png" 
       OpacityMask="Black" 
       Panel.ZIndex="1">
    <Image.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="T_Image"
                                     Storyboard.TargetProperty="Height"
                                     From="300" To="85" Duration="00:00:00.75" />
                    <DoubleAnimation Storyboard.TargetName="T_Image"
                                     Storyboard.TargetProperty="Width"
                                     From="300" To="105" Duration="00:00:0.75" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Image.Triggers>
</Image>

If the image does not get rendered at all, it is likely that the Image.Source URI is incorrect. 如果完全没有渲染图像,则可能是Image.Source URI不正确。 Read up on using the proper Pack URIs and it may solve your problem. 阅读使用正确的Pack URI的内容 ,它可能会解决您的问题。

Here is an answer I gave previously that worked just fine. 是我之前给出的答案,效果很好。 The image resource was located in the same project as the XAML and is under an assests/images folder. 图像资源与XAML位于同一项目中,并且位于assests/images文件夹下。

使用我的原始代码和代码修复了该问题,删除了OpacityMask Panel Z索引并更改为静态路径,现在修复了该问题,我只需要找到一种使路径动态化至运行其的任何计算机的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM