Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm use blend to create States and I use Timeline to move object from place to place
problem is.. I can't get object's position while timeline is running, Result is freezing
event though i'm use timer to track position
Here is my code.
C#
private void b1_Click(object sender, RoutedEventArgs e)
        {
            state1.Storyboard.Begin();  //play timeline in states
        }

void updatePos_Tick(object sender, object e)
        {
            textblock.text = Canvas.getLeft(myobject);
        }

On the screen, "myobject" is moving but "textblock" doesn't tell me where really are, please help, thanks.
Posted
Comments
Ron Beyer 16-Jan-14 11:56am    
Why don't you bind the textblock text to the objects position in XAML?
setafonnix 16-Jan-14 12:09pm    
Thanks for reply, but I don't know how to do, may I see some example?

1 solution

I have found answer by myself today (took 3 months haha)
Just use timer tick This...
[C#]
C#
textblock.Text = myMovingCanvas.RenderTransform.GetValue(CompositeTransform.TranslateXProperty).ToString(); 


Because storyboard's target use this properties...
[xaml]
XAML
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="myMovingCanvas"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900