Cannot animate RenderTransform: 'root element is frozen'
Posted: 23 Jun 2014, 14:51
Hi,
I am trying to animate a control when it becomes enabled/disabled. This is what I have so far:
This works in WPF (I've tested it in Kaxaml), but in NoesisGUI I get this exception:
What can I do to make this work?
I am trying to animate a control when it becomes enabled/disabled. This is what I have so far:
Code: Select all
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<Style x:Key="AnimationButton" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Ellipse Fill="Black" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" x:Name="ellipse" Opacity="1">
<Ellipse.RenderTransform>
<TranslateTransform X="0" x:Name="trans" />
</Ellipse.RenderTransform>
</Ellipse>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard AutoReverse="False">
<DoubleAnimation Storyboard.TargetName="ellipse" Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:01"></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="trans" Storyboard.TargetProperty="(TranslateTransform.X)" To="100" Duration="00:00:01"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard AutoReverse="False">
<DoubleAnimation Storyboard.TargetName="ellipse" Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:01"></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="trans" Storyboard.TargetProperty="(TranslateTransform.X)" To="0" Duration="00:00:01"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<CheckBox x:Name="chk" IsChecked="True">enabled</CheckBox>
<Button Width="200" Height="200"
IsEnabled="{Binding IsChecked, ElementName=chk}"
Style="{StaticResource AnimationButton}">
</Button>
</Grid>
</UserControl>
Code: Select all
Exception: Can't animate path '(TranslateTransform.x)' because root element is frozen
Noesis.Error.Check () (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisError.cs:60)