1

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?
basarat
  • 261,912
  • 58
  • 460
  • 511

2 Answers2

3

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.

Justin XL
  • 38,763
  • 7
  • 88
  • 133
  • 1
    +1 Absolutely right, Triggers are a WPF concept. The StockTrader RI application the OP mentioned is indeed WPF. ControlStoryBoardAction Behavior is the way to go for Silverlight. – bendewey Apr 25 '11 at 16:11
0

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)

Kir
  • 2,905
  • 2
  • 27
  • 44