Hello,
I am trying to animate the position of a RadWindow using a DataTrigger.
The following demonstrates what I am trying to achieve:
When loaded, an exception is thrown:
System.Windows.Media.Animation.AnimationException was unhandled
HResult=-2146233087
Message=Cannot animate the 'Top' property on a 'TelerikRadWindow.MainWindow' using a 'System.Windows.Media.Animation.DoubleAnimation'. For details see the inner exception.
Source=PresentationCore
StackTrace:
at System.Windows.Media.Animation.AnimationStorage.OnCurrentTimeInvalidated(Object sender, EventArgs args)
at System.Windows.Media.Animation.Clock.FireEvent(EventPrivateKey key)
at System.Windows.Media.Animation.Clock.RaiseAccumulatedEvents()
at System.Windows.Media.Animation.TimeManager.RaiseEnqueuedEvents()
at System.Windows.Media.Animation.TimeManager.Tick()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at TelerikRadWindow.App.Main() in c:\Users\martin.galpin\Documents\Visual Studio 2012\Projects\TelerikRadWindow\TelerikRadWindow\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.InvalidOperationException
HResult=-2146233079
Message='System.Windows.Media.Animation.DoubleAnimation' cannot use default origin value of 'NaN'.
Source=PresentationCore
StackTrace:
at System.Windows.Media.Animation.DoubleAnimation.GetCurrentValueCore(Double defaultOriginValue, Double defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.DoubleAnimationBase.GetCurrentValue(Double defaultOriginValue, Double defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.DoubleAnimationBase.GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.AnimationClock.GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue)
at System.Windows.Media.Animation.AnimationLayer.GetCurrentValue(Object defaultDestinationValue)
at System.Windows.Media.Animation.AnimationStorage.GetCurrentPropertyValue(AnimationStorage storage, DependencyObject d, DependencyProperty dp, PropertyMetadata metadata, Object baseValue)
at System.Windows.Media.Animation.AnimationStorage.OnCurrentTimeInvalidated(Object sender, EventArgs args)
InnerException:
This exact same sample works when using a Window rather than a RadWindow.
Does anybody have any idea why this is or what I can do to resolve it?
Many thanks.
I am trying to animate the position of a RadWindow using a DataTrigger.
The following demonstrates what I am trying to achieve:
<telerik:RadWindow x:Class="TelerikRadWindow.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Height="350" Width="525" WindowStartupLocation="CenterScreen"> <telerik:RadWindow.Style> <Style TargetType="telerik:RadWindow"> <Style.Triggers> <DataTrigger Binding="{Binding ShouldMoveWindow}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="(Window.Top)" To="+200" BeginTime="0:0:0" Duration="0:0:5" /> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> </DataTrigger> </Style.Triggers> </Style> </telerik:RadWindow.Style></telerik:RadWindow>namespace TelerikRadWindow{ public partial class MainWindow { public MainWindow() { InitializeComponent(); ShouldMoveWindow = true; DataContext = this; } public bool ShouldMoveWindow { get; set; } }}When loaded, an exception is thrown:
System.Windows.Media.Animation.AnimationException was unhandled
HResult=-2146233087
Message=Cannot animate the 'Top' property on a 'TelerikRadWindow.MainWindow' using a 'System.Windows.Media.Animation.DoubleAnimation'. For details see the inner exception.
Source=PresentationCore
StackTrace:
at System.Windows.Media.Animation.AnimationStorage.OnCurrentTimeInvalidated(Object sender, EventArgs args)
at System.Windows.Media.Animation.Clock.FireEvent(EventPrivateKey key)
at System.Windows.Media.Animation.Clock.RaiseAccumulatedEvents()
at System.Windows.Media.Animation.TimeManager.RaiseEnqueuedEvents()
at System.Windows.Media.Animation.TimeManager.Tick()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at TelerikRadWindow.App.Main() in c:\Users\martin.galpin\Documents\Visual Studio 2012\Projects\TelerikRadWindow\TelerikRadWindow\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.InvalidOperationException
HResult=-2146233079
Message='System.Windows.Media.Animation.DoubleAnimation' cannot use default origin value of 'NaN'.
Source=PresentationCore
StackTrace:
at System.Windows.Media.Animation.DoubleAnimation.GetCurrentValueCore(Double defaultOriginValue, Double defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.DoubleAnimationBase.GetCurrentValue(Double defaultOriginValue, Double defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.DoubleAnimationBase.GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.AnimationClock.GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue)
at System.Windows.Media.Animation.AnimationLayer.GetCurrentValue(Object defaultDestinationValue)
at System.Windows.Media.Animation.AnimationStorage.GetCurrentPropertyValue(AnimationStorage storage, DependencyObject d, DependencyProperty dp, PropertyMetadata metadata, Object baseValue)
at System.Windows.Media.Animation.AnimationStorage.OnCurrentTimeInvalidated(Object sender, EventArgs args)
InnerException:
This exact same sample works when using a Window rather than a RadWindow.
Does anybody have any idea why this is or what I can do to resolve it?
Many thanks.