在 silverlight 中开始加载事件的故事板

发布于 2024-11-03 15:13:45 字数 530 浏览 1 评论 0原文

我正在查看 Prism Stocktrader RI,我可以看到 InTransition Storyboard 是使用代码来播放的。我尝试了以下 xaml:

    <UserControl.Triggers>
        <EventTrigger RoutedEvent="UserControl.Loaded">
            <BeginStoryboard Storyboard="{StaticResource InTransition}"/>
        </EventTrigger>
    </UserControl.Triggers>
But it gives the following error on InitializeComponent (i.e. a XamlParseException):
enter image description here
any idea why?

I am looking at the Prism Stocktrader RI and I can see that the InTransition Storyboard is played using code. I tried the following xaml:

    <UserControl.Triggers>
<EventTrigger RoutedEvent="UserControl.Loaded">
<BeginStoryboard Storyboard="{StaticResource InTransition}"/>
</EventTrigger>
</UserControl.Triggers>

But it gives the following error on InitializeComponent (i.e. a XamlParseException):
enter image description here

any idea why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

桃扇骨 2024-11-10 15:13:45

我认为触发器在 Silverlight 中不可用。

您可以使用 ControlStoryboardAction 行为在 xaml 中调用故事板,如下所示(您将需要 Microsoft.Expression.Interactions.dll 和 System.Windows.Interactivity.dll),

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 

<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <ei:ControlStoryboardAction Storyboard="{StaticResource InTransition}"/>
    </i:EventTrigger>
</i:Interaction.Triggers>

注意:您可以删除 EventName ='Loaded' 因为'Loaded' 是该控件的默认事件。

I think triggers are not available in Silverlight.

You can use a ControlStoryboardAction behavior to call a storyboard in xaml, like the following (you will need Microsoft.Expression.Interactions.dll and System.Windows.Interactivity.dll),

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 

<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <ei:ControlStoryboardAction Storyboard="{StaticResource InTransition}"/>
    </i:EventTrigger>
</i:Interaction.Triggers>

Note: you can remove EventName='Loaded' as 'Loaded' is the default event for this control.

£噩梦荏苒 2024-11-10 15:13:45

通常对于此类错误,存在内部异常。请执行“查看详细信息”并为我们检查。

该错误通常意味着它无法正确解析资源,因此您可能需要查看 InTransition 是什么(如果这对您没有帮助,请发布)

Usually for such errors there's an Inner Exception. Please do "View Detail" and check on that for us.

The error generally means it couldn't resolve the resource correctly, so you might need to look at what InTransition is (please post that if this doesn't help you)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文