Shared animations caused Invalid operation

7 posts, 0 answers
  1. Nigel
    Nigel avatar
    4 posts
    Member since:
    Oct 2010

    Posted 17 Feb 2013 Link to this post

    I have a view containing multiple data-bound list boxes in a pivot. I was wanting to make use of the Item Added Animation and because there are a number of similar lists throughout the application am using xaml styles. However I'm seeing a crash whenever two lists with the same style are on the page, but only when the animations are set.

    The assembly version is Telerik.Windows.Controls.Primitives, Version=2012.3.1311.3040, Culture=neutral, PublicKeyToken=5803cfa389c90ce7

    The style I'm using is the following.

    <Style x:Key="AnimatedList" TargetType="telerikPrimitives:RadDataBoundListBox">
            <Setter Property="Margin" Value="0,0,-12,0" />
            <Setter Property="ItemAddedAnimation">
                <Setter.Value>
                    <telerikCore:RadFadeAnimation StartOpacity="0" EndOpacity="1" Duration="0:0:1">
                        <telerikCore:RadFadeAnimation.Easing>
                            <ExponentialEase Exponent="6" EasingMode="EaseOut"/>
                        </telerikCore:RadFadeAnimation.Easing>
                    </telerikCore:RadFadeAnimation>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemRemovedAnimation">
                <Setter.Value>
                    <telerikCore:RadFadeAnimation StartOpacity="1" EndOpacity="0" Duration="0:0:1">
                        <telerikCore:RadFadeAnimation.Easing>
                            <ExponentialEase Exponent="6" EasingMode="EaseIn"/>
                        </telerikCore:RadFadeAnimation.Easing>
                    </telerikCore:RadFadeAnimation>
                </Setter.Value>
            </Setter>
        </Style>

    The stack trace is as follows:
       at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
       at System.Collections.Generic.Queue`1.Dequeue()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnItemAddedAnimation_Ended(Object sender, EventArgs e)
       at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
       at Telerik.Windows.Controls.RadAnimation.OnEnded()
       at Telerik.Windows.Controls.RadAnimation.OnStopped(PlayAnimationInfo info)
       at Telerik.Windows.Controls.RadAnimationManager.StopStoryboard(PlayAnimationInfo info)
       at Telerik.Windows.Controls.RadAnimationManager.OnStoryboardCompleted(Object sender, EventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

    Removing the animation properties stops the error 100% of the time as does moving the animation definition from the style to the list box, but given this style is being used twenty plus times this isn't a long term maintainable solution.

    Cheers
  2. Nigel
    Nigel avatar
    4 posts
    Member since:
    Oct 2010

    Posted 20 Feb 2013 Link to this post

    I can confirm this issue isn't resolved in the Windows Phone 8 2013 Q1 release.
  3. DevCraft banner
  4. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 21 Feb 2013 Link to this post

    Hello Nigel,

    Thanks for writing and please excuse us for the delay with our answer.

    We do not support this approach in RadDataBoundListBox currently. You will have to define the animations inline wherever you have a ListBox control in your application.

    The reason for this behavior is that in the ListBox we internally handle events exposed by the animations and when these animations are static and you have multiple listboxes attached to them, they all will handle events which might not be directly related to them.

    I hope this helps.

    All the best,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  5. Andrey
    Andrey avatar
    9 posts
    Member since:
    Feb 2013

    Posted 17 Apr 2013 Link to this post

    Correct if i'm wrong but i think we could use x:Shared="false" on resource, at least on Animation object in dictionary, but its impossible on WP8 ?
  6. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 22 Apr 2013 Link to this post

    Hi Andrey,

    The animations used by RadDataBoundListBox are custom objects and they do not support this property.

    Regards,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  7. Ryan
    Ryan avatar
    21 posts
    Member since:
    Apr 2013

    Posted 22 Aug 2013 Link to this post

    Hi Deyan,

    I was just running into this problem and fortunately stumbled upon this thread before wasting too much time.

    Is there a plan to support reusable animation resources across multiple listboxes in the future? It's very annoying to have to redefine the same animation over and over.

    Thanks
    Ryan
  8. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 23 Aug 2013 Link to this post

    Hello Ryan,

    Thanks for writing.

    We will put this on our TODO list and will try to re-architecture the animations so that they support these scenarios.

    Let us know should you have further questions or need assistance.

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner