- darthmaule2
- Posts: 98
- Joined:
Crash when trying to attach command to storyboard completed event [Managed SDK version 2.2.4]
First I tried it this way, as per another forum post I saw:
But during the xaml parsing, the debug claims it cannot find EventToCommand.
So then I tried what I thought was the newer approach:
But this crashes at runtime here:
Any ideas?
Code: Select all
<UserControl x:Class="Controls.SoftButton.SoftButtonControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Controls.SoftButton"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:noesis="clr-namespace:NoesisGUIExtensions">
<UserControl.Resources>
<Storyboard x:Key="MenuItemLoad" noesis:EventToCommand.Event="Completed" noesis:EventToCommand.Command="{Binding SbUnloadStoryboardCommand}">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="MenuItemBorder">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
...
So then I tried what I thought was the newer approach:
Code: Select all
<Storyboard x:Key="MenuItemLoad">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Completed">
<i:InvokeCommandAction Command="{Binding SbLoadStoryboardCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="MenuItemBorder">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
Code: Select all
GUI.LoadComponent(this, "Controls.SoftButton.SoftButtonControl.xaml");
- darthmaule2
- Posts: 98
- Joined:
Re: Crash when trying to attach command to storyboard completed event [Managed SDK version 2.2.4]
Here's the stack trace:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Noesis.View.Noesis_View_Find(System.Runtime.InteropServices.HandleRef)
at Noesis.View.Noesis_View_Find(System.Runtime.InteropServices.HandleRef)
at Noesis.View.Find(Noesis.BaseComponent)
at NoesisApp.AttachableObject.Attach(Noesis.DependencyObject)
at NoesisApp.TriggerCollection.OnAttached()
at NoesisApp.AttachableCollection`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Attach(Noesis.DependencyObject)
at NoesisApp.Interaction.OnTriggersChanged(Noesis.DependencyObject, Noesis.DependencyPropertyChangedEventArgs)
at Noesis.PropertyMetadata.OnPropertyChanged(IntPtr, IntPtr, IntPtr)
at Noesis.GUI.Noesis_LoadComponent(System.Runtime.InteropServices.HandleRef, System.String)
at Noesis.GUI.Noesis_LoadComponent(System.Runtime.InteropServices.HandleRef, System.String)
at Noesis.GUI.LoadComponent(System.Object, System.String)
at Controls.SoftButton.SoftButtonControl.InitializeComponent()
at Controls.SoftButton.SoftButtonControl..ctor(System.String, Controls.SoftButton.SoftButtonViewModel)
at UIShell.App.RunApplication(SimpleInjector.Container)
at UIShell.App.OnStartup(NoesisApp.StartupEventArgs)
at NoesisApp.Application.Start()
at NoesisApp.Application.Run()
at UIShell.App.Main(System.String[])
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Noesis.View.Noesis_View_Find(System.Runtime.InteropServices.HandleRef)
at Noesis.View.Noesis_View_Find(System.Runtime.InteropServices.HandleRef)
at Noesis.View.Find(Noesis.BaseComponent)
at NoesisApp.AttachableObject.Attach(Noesis.DependencyObject)
at NoesisApp.TriggerCollection.OnAttached()
at NoesisApp.AttachableCollection`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Attach(Noesis.DependencyObject)
at NoesisApp.Interaction.OnTriggersChanged(Noesis.DependencyObject, Noesis.DependencyPropertyChangedEventArgs)
at Noesis.PropertyMetadata.OnPropertyChanged(IntPtr, IntPtr, IntPtr)
at Noesis.GUI.Noesis_LoadComponent(System.Runtime.InteropServices.HandleRef, System.String)
at Noesis.GUI.Noesis_LoadComponent(System.Runtime.InteropServices.HandleRef, System.String)
at Noesis.GUI.LoadComponent(System.Object, System.String)
at Controls.SoftButton.SoftButtonControl.InitializeComponent()
at Controls.SoftButton.SoftButtonControl..ctor(System.String, Controls.SoftButton.SoftButtonViewModel)
at UIShell.App.RunApplication(SimpleInjector.Container)
at UIShell.App.OnStartup(NoesisApp.StartupEventArgs)
at NoesisApp.Application.Start()
at NoesisApp.Application.Run()
at UIShell.App.Main(System.String[])
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Crash when trying to attach command to storyboard completed event [Managed SDK version 2.2.4]
The code you wrote should have worked, but there was a bug we just fixed when using i:EventTrigger in a Storyboard resource. It will be solved in the next release.
In the meantime you can move the trigger to a element in the tree, and use the StoryboardCompletedTriger:
In the meantime you can move the trigger to a element in the tree, and use the StoryboardCompletedTriger:
Code: Select all
<Grid x:Name="LayoutRoot">
<i:Interaction.Triggers>
<i:StoryboardCompletedTrigger Storyboard="{StaticResource Intro}">
<i:InvokeCommandAction Command="{Binding StartCommand}"/>
</i:StoryboardCompletedTrigger>
</i:Interaction.Triggers>
...
</Grid>
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests