Specified value of type 'System.Windows.Interactivity.EventTrigger' must have IsFrozen set to false to modify.

463 views
Skip to first unread message

Laurent Bugnion

unread,
Mar 10, 2011, 3:27:43 PM3/10/11
to wpf-di...@googlegroups.com

Hey guys,

 

This kind of differences between WPF and Silverlight is driving me nuts…

 

I am modifying the EventToCommand in MVVM Light to make it attachable to non FrameworkElement objects, such as Storyboard. The idea is to allow something like this:

 

<ResourceDictionary>

    <Storyboard x:Name="MyStoryboard"

                Storyboard.TargetName="TestEventToCommandWithStoryboardButton">

        <i:Interaction.Triggers>

            <i:EventTrigger EventName="Completed">

                <cmd:EventToCommand Command="{Binding Source={StaticResource Locator}, Path=Main.StoryboardCompletedCommand}" />

            </i:EventTrigger>

        </i:Interaction.Triggers>

 

        <DoubleAnimation Storyboard.TargetProperty="Opacity"

                            To="0"

                           Duration="0:0:2" />

    </Storyboard>

 

</ResourceDictionary>

 

In Silverlight 3 and 4, this works great. The event is raised, the command is executed.

 

In WPF3.5 and 4, I get “Specified value of type 'System.Windows.Interactivity.EventTrigger' must have IsFrozen set to false to modify” when the storyboard is completed.

 

I thought it had to do with the fact that the Storyboard is in the resources but the same error occurs when it is created in code at runtime.

 

Is there any workaround?

Thanks,

Laurent

--

Laurent Bugnion

Director, UX Integration Development, IdentityMine

Microsoft MVP, MCP

www.galasoft.ch | blog.galasoft.ch

 

Peter O'Hanlon

unread,
Mar 10, 2011, 5:13:19 PM3/10/11
to wpf-di...@googlegroups.com
You could possibly, in the internal code, do this:

Storyboard animation = (Storyboard)this.FindResource("TestEventToCommandWithStoryboardButton");
clonedAnimation = animation.Clone();

Storyboard animation = (Storyboard)this.FindResource("OnUnloaded1");
--
Peter O'Hanlon
Reply all
Reply to author
Forward
0 new messages