Issue with databinding in animations for ContentControl/ItemsControl
Posted: 10 Jul 2020, 10:03
There is some sort of issue with databinding for animations inside of ContentControl/ItemsControl. The following (xamltoy ready) example creates a Rectangle and animates its Fill, which has an initial value of pink. It should animate between Green and Blue, with the Blue coming from databinding. In Blend this is what happens. In Noesis instead it animates from Green to Pink because the databinding fails:
Noesis itself does not report any errors/warnings in the outputted log.
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ContentControl>
<ContentControl.Content>
<Color>#ff0000ff</Color>
</ContentControl.Content>
<ContentControl.ContentTemplate>
<DataTemplate>
<Grid>
<Rectangle Name="SomeRect" Width="200" Height="200" Fill="Pink">
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Duration="0:0:5"
From="Green"
To="{Binding}"
AutoReverse="True" RepeatBehavior="Forever"
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="SomeRect">
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</Grid>
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</Grid>