Animation problem with binding a resource
Hi,
I am using NoesisGUI to develop 2D game and i have problem with binding a resource in DiscreteObjectKeyFrame.
This code works:
<DiscreteObjectKeyFrame KeyTime="0:0:0.08">
<DiscreteObjectKeyFrame.Value>
<ImageBrush ImageSource="images/chew_man_chew/rompetejas02.png"/>
</DiscreteObjectKeyFrame.Value>
But this code not works:
<UserControl.Resources>
<ImageBrush x:Key="ImgRompetejas02" ImageSource="images/chew_man_chew/rompetejas02.png"/>
</UserControl.Resources>
<DiscreteObjectKeyFrame KeyTime="0:0:0.08" Value="{StaticResource ImgRompetejas02}">
However I can use the resource "ImgRompetejas02" here:
<Border x:Name="ChewManChew" Width="128" Height="128" Background="{StaticResource ImgRompetejas02"}/>


In XamlPad it works both ways.
Thanks.
I am using NoesisGUI to develop 2D game and i have problem with binding a resource in DiscreteObjectKeyFrame.
This code works:
<DiscreteObjectKeyFrame KeyTime="0:0:0.08">
<DiscreteObjectKeyFrame.Value>
<ImageBrush ImageSource="images/chew_man_chew/rompetejas02.png"/>
</DiscreteObjectKeyFrame.Value>
But this code not works:
<UserControl.Resources>
<ImageBrush x:Key="ImgRompetejas02" ImageSource="images/chew_man_chew/rompetejas02.png"/>
</UserControl.Resources>
<DiscreteObjectKeyFrame KeyTime="0:0:0.08" Value="{StaticResource ImgRompetejas02}">
However I can use the resource "ImgRompetejas02" here:
<Border x:Name="ChewManChew" Width="128" Height="128" Background="{StaticResource ImgRompetejas02"}/>


In XamlPad it works both ways.
Thanks.
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Animation problem with binding a resource
I found the bug.
Meanwhile you can turn around the problem by defining the Storyboard in the root element Resources property, and refer to it from the BeginStoryboard action with a StaticResource:
Meanwhile you can turn around the problem by defining the Storyboard in the root element Resources property, and refer to it from the BeginStoryboard action with a StaticResource:
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid.Resources>
<ImageBrush x:Key="ImgRompetejas02" ImageSource="images/chew_man_chew/rompetejas02.png"/>
<Storyboard x:Key="AnimImg">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ImgRompetejas02}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Rectangle Fill="SkyBlue" Width="125" Height="125">
<Rectangle.Triggers>
<EventTrigger RoutedEvent="UIElement.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard Storyboard="{StaticResource AnimImg}"/>
</EventTrigger.Actions>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</Grid>
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Animation problem with binding a resource
The problem discussed in this topic was fixed in v0.9.1.
Who is online
Users browsing this forum: Google [Bot] and 0 guests