开发者

Trying to animate a property based on a custom control's event using xaml on WP7

My XAML looks like this:

    <me:MyControl x:Name="Publisher">
        <me:MyControl.Triggers>
            <EventTrigger RoutedEvent="me:MyControl.MyEvent">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation
                            Storyboard.TargetName="Publisher"
                            Storyboard.TargetProperty="Opacity"
                            To="1" Duration="0:0:1"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger -->
        </me:MyControl.Triggers>
    </me:MyCo开发者_开发百科ntrol>

When this loads I get an exception saying

Attribute me:MyControl.MyEventvalue is out of range

I've tried

  • me:MyControl.MyEvent
  • MyControl.MyEvent
  • MyEvent
  • Publisher.MyEvent

What's the magic incantation to get this to work?


You've be looking at WPF examples, Silverlight doesn't directly support any trigger other than for the loaded event.

Consider using the VisualStateManager instead. You then need to change the state via code on the event.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜