This question is locked. New answers and comments are not allowed.
Hello Telerik team!
As I've already posted here: http://www.telerik.com/community/forums/silverlight/scheduleview/appointment-creation-animation.aspx#1837399
I want to animate the creation of an Appointment. I did it through the "ItemTemplate" and "Loaded" event (see code below)
The problem is (looks like a bug), that the DataContext of the ItemTemplate is always the last Appointment of the Collection (in the UI-order).
This means - if I create a new appointment below all others, the DataContext is the created appointment and I can animate it (correct behavior)
But if I create an appointment somewhere in the middle of all appointments - DataContext in the Loaded-event is the last appointment again and it will animate again.
Can You explain why does this happen?
private void templateGrid_Loaded(object sender, RoutedEventArgs e)
{
if ((((sender as Grid).DataContext as Telerik.Windows.Controls.AppointmentItemProxy).Appointment as AppointmentWrapper).NewFlag)
((sender as Grid).Resources["colorizeStoryboard"] as Storyboard).Begin();
}
<DataTemplate x:Key="AppointmentItemTemplate" >
<Grid VerticalAlignment="Top" Name="templateGrid"Loaded="templateGrid_Loaded">
<Grid.Resources>
<Storyboard x:Key="colorizeStoryboard">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="templateGrid" Storyboard.TargetProperty="(Grid.Background).(SolidColorBrush.Color)" >
<EasingColorKeyFrame KeyTime="00:00:02" Value="Green" />
<EasingColorKeyFrame KeyTime="00:00:04" Value="Blue" />
<EasingColorKeyFrame KeyTime="00:00:06" Value="Transparent" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<TextBlock Margin="8,2" TextWrapping="Wrap" Text="{Binding Appointment.Subject}" />
</Grid>
</DataTemplate>