Animating with c#

4 posts, 0 answers
  1. Michael
    Michael avatar
    4 posts
    Member since:
    May 2014

    Posted 23 Oct 2014 Link to this post

    I have a DataboundListBox and I am trying to play an animation that allows the current data in the list box to slide out and the new one to slide In. I would like to define the animation in code behind and not XAML

    How to I translate this code and attach it to a listbox in c#

    <telerikPrimitives:RadDataBoundListBox.ItemRemovedAnimation>
        <telerikCore:RadMoveAnimation StartPoint="0, 0" EndPoint="500, 0" Duration="0:0:10">
            <telerikCore:RadMoveAnimation.Easing>
                <CubicEase EasingMode="EaseIn"/>
            </telerikCore:RadMoveAnimation.Easing>
        </telerikCore:RadMoveAnimation>
    </telerikPrimitives:RadDataBoundListBox.ItemRemovedAnimation>
  2. Michael
    Michael avatar
    4 posts
    Member since:
    May 2014

    Posted 24 Oct 2014 Link to this post

    Is thee any other online resource that may be able to dive a little deeper that would give examples of how to create custom animations in code and assign them to different events of the DataBoundListBox. I would like to be able to control what animation the ListBox displays in my code and not xaml
  3. DevCraft banner
  4. Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 27 Oct 2014 Link to this post

    Hi Michael,

    You can follow the XAML declaration to initialize the animations in C#. For example the described animation can be assigned to the RadDataBoundListBox like this:

    this.DataBoundListBox.ItemRemovedAnimation = new RadMoveAnimation() { StartPoint = new Point(0, 0), EndPoint = new Point(500, 0), Duration = new Duration(TimeSpan.FromSeconds(10)), Easing = new CubicEase() { EasingMode = EasingMode.EaseIn } };

    Similarly you can create animation to slide in the new source like this:

    this.DataBoundListBox.ItemAddedAnimation = new RadMoveAnimation() { StartPoint = new Point(500, 0), EndPoint = new Point(0, 0), Duration = new Duration(TimeSpan.FromSeconds(10)), Easing = new CubicEase() { EasingMode = EasingMode.EaseIn } };

    For more reference, you can check our online documentation where each example is shown in both xaml and C#.

    I hope this helps. Let me know should you need further assistance.

    Regards,
    Ivaylo Gergov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Michael
    Michael avatar
    4 posts
    Member since:
    May 2014

    Posted 31 Oct 2014 in reply to Ivaylo Gergov Link to this post

    Thanks for your help, works great.
Back to Top