Invoking animation on VisibilityProperty from code behind throws an exception
Hi!
I have created a storyboard with several animations, which I clone and change targets in code behind. All animations are DoubleAnimation, except for one which is ObjectAnimationUsingKeyFrames on Visibility. Whenever I run that one it throws an exception:
I've tested it again by modifying sample ApplicationTutorial and creating a storyboard as a resource and running it in code behind, I get the same problem.
[
I have created a storyboard with several animations, which I clone and change targets in code behind. All animations are DoubleAnimation, except for one which is ObjectAnimationUsingKeyFrames on Visibility. Whenever I run that one it throws an exception:
Code: Select all
System.InvalidOperationException
HResult=0x80131509
Message=Native type is not registered
Source=Noesis.GUI
StackTrace:
at Noesis.Extend.GetNativeTypeInfo(IntPtr nativeType)
at Noesis.AnimationTimeline.get_TargetPropertyType()
at Noesis.AnimationTimeline.IsValidTarget(DependencyProperty dp)
at Noesis.UIElement.BeginAnimation(DependencyProperty dp, AnimationTimeline animation, HandoffBehavior handoffBehavior)
at Noesis.UIElement.BeginAnimation(DependencyProperty dp, AnimationTimeline animation)
at RssReader.MainWindow.OnNextClicked(Object sender, RoutedEventArgs e) in F:\WORK\NoesisGUI-ManagedSDK-3.1.2\Src\Samples\ApplicationTutorial\Src\MainWindow.xaml.cs:line 113
at Noesis.RoutedEventArgs.InvokeHandler(Delegate handler, IntPtr sender, IntPtr args)
at Noesis.EventManager.InvokeHandler(IntPtr routedEventPtr, Delegate handler, IntPtr sender, IntPtr args)
at Noesis.EventHandlerStore.RaiseRoutedEvent(IntPtr cPtrType, IntPtr cPtr, IntPtr routedEvent, IntPtr sender, IntPtr e)
[
Code: Select all
<Window.Resources>
<Storyboard x:Key="TestStoryboard">
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="Prev"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="00:00:00.0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
Code: Select all
void OnNextClicked(object sender, RoutedEventArgs e)
{
var board = (Storyboard)FindResource("TestStoryboard");
// board.Begin(); // this works but doesn't allow me to specify individual animations' targets
var anim = (AnimationTimeline)board.Children[0];
var bt = (Button)FindName("Prev");
// none of these 3 work in Noesis even if I set the target to the same value as original. Skipping them all and just running BeginAnimation also doesn't work.
//anim.SetValue(Storyboard.TargetNameProperty, "Prev");
//Storyboard.SetTarget(anim, bt);
//Storyboard.SetTargetName(anim, "Prev");
bt.BeginAnimation(Button.VisibilityProperty, anim);
}
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Invoking animation on VisibilityProperty from code behind throws an exception
Could you please report this in our bugtracker, it is clearly a bug.
Thanks for your collaboration.
In the meantime, you can create a Storyboard to launch the animation directly (instead of calling element.BeginAnimation):
Thanks for your collaboration.
In the meantime, you can create a Storyboard to launch the animation directly (instead of calling element.BeginAnimation):
Code: Select all
Storyboar storyboard = CreateAnimation(...);
storyboard.Begin(element)
Re: Invoking animation on VisibilityProperty from code behind throws an exception
Alright, I've added the report. Thanks for your help!
https://www.noesisengine.com/bugs/view.php?id=2280
https://www.noesisengine.com/bugs/view.php?id=2280
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Who is online
Users browsing this forum: Ahrefs [Bot], maherne and 51 guests