This is a migrated thread and some comments may be shown as answers.

Animating with c#

3 Answers 59 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 24 Oct 2014, 12:48 AM
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>

3 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 24 Oct 2014, 02:57 PM
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
0
Ivaylo Gergov
Telerik team
answered on 27 Oct 2014, 07:12 AM
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.

 
0
Michael
Top achievements
Rank 1
answered on 31 Oct 2014, 01:41 PM
Thanks for your help, works great.
Tags
DataBoundListBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Share this question
or