Oleg Sh
Oleg Sh

Reputation: 9013

Silverlight - how to set trigger to popup

I have a popup with UserControl inside. I need to hide this popup and want to create it by trigger. I try the following code:

            <Popup.Triggers>
                <EventTrigger RoutedEvent="Popup.MouseLeave">
                <EventTrigger.Actions>
                    <BeginStoryboard>
                        <Storyboard RepeatBehavior="Forever">
                                <DoubleAnimation Storyboard.TargetName="popup"
                                             Storyboard.TargetProperty="Popup.IsOpen"
                                             To="False" From="True" Duration="0:0:2">
                            </DoubleAnimation>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger.Actions>
            </EventTrigger>
            </Popup.Triggers>
            <blib:TimeZones></blib:TimeZones>
        </Popup>

but it does not work

Failed to assign to property 'System.Windows.EventTrigger.RoutedEvent'. [Line: 55 Position: 47]

How to make it correctly?

Upvotes: 0

Views: 450

Answers (1)

alf
alf

Reputation: 18550

Triggers in Silverlight don't work in the same way as WPF triggers do. You need to use the interactivity library. Check out this article: http://www.silverlightshow.net/items/Behaviors-and-Triggers-in-Silverlight-3.aspx

Upvotes: 1

Related Questions