I have the following problem:
I have an Ellipse Geometry that I animate by updating its Translate
Transfrom X and Y properties,
the animation runs fine but when attempting to place the element from its
current parent (Canvas) to a Stack Panel, the element is not visible in the
stack panel though it seems like it has been added Stack Panel as height
changes.
If I do not apply the animation and just run the code to dock the element
into the Stack Panel (DockIntoQueryStackPanel) then it all works fine
Heres a snippet of the code
private void animateToStackPanel(UIElement uiEl, int ii)
{
//apply animation to this venn circle
FrameworkElement ctl = uiEl as FrameworkElement;
Path path = uiEl as Path;
EllipseGeometry eG = path.Data as EllipseGeometry;
TranslateTransform tt = eG.Transform as TranslateTransform;
if (tt.X > 0)
{
// create movement animation
double endX =
(this.MainGrid.ColumnDefinitions[0].ActualWidth / SizeSlider.Value) +
(eG.RadiusX /
SizeSlider.Value);// -tt.X;// -(this.MainGrid.ColumnDefinitions[1].ActualWidth
/ 5);
double endY = (400 / SizeSlider.Value);//+ (eG.RadiusX /
SizeSlider.Value);// -tt.X;// -(this.MainGrid.ColumnDefinitions[1].ActualWidth
/ 5);
DoubleAnimation moveToStackX = new DoubleAnimation(tt.X,
endX, new Duration(TimeSpan.FromSeconds(ii)));
DoubleAnimation moveToStackY = new DoubleAnimation(tt.Y,
endY, new Duration(TimeSpan.FromSeconds(ii)));
String vName = "tt" + path.Name;
if (this.FindName(vName) == null)
{
RegisterName(vName, tt);
}
//setup X animation
Storyboard.SetTargetName(moveToStackX, vName);
Storyboard.SetTargetProperty(moveToStackX, new
PropertyPath(TranslateTransform.XProperty));
//setup Y animation
Storyboard.SetTargetName(moveToStackY, vName);
Storyboard.SetTargetProperty(moveToStackY, new
PropertyPath(TranslateTransform.YProperty));
myStoryBoard.Children.Add(moveToStackX);
myStoryBoard.Children.Add(moveToStackY);
myStoryBoard.Completed += new
EventHandler(myStoryBoard_Completed);
myStoryBoard.Begin(path);
}
}
void myStoryBoard_Completed(object sender, EventArgs e)
{
myStoryBoard.Children.Clear();
UIElement uiEl = (UIElement) elCollection.Pop();
//dropUIElement(el);
DockIntoQueryStackPanel(uiEl);
}
Any help appreciated?
Regards
Ranjit
Creating a new TranslationTransform settings its X and Y to 0 and applying
that to the EllipseGeometry.
For some unknown reason the X and Y of the TranslateTransform that were
animated do not get updated, even if I explicity reset the X and Y in code
to 0, there is no runtime error but just ignores the resetting to 0.
"Ranj" <rs...@removethis.hotmail.com> wrote in message
news:%231x3ozE...@TK2MSFTNGP04.phx.gbl...
In the way the framework evaluate a property`s value, an animation has
the precedence over everything else...
There is a possibility that the property engine still evaluates the X
and Y of the transform according to the animation, instead of the
"local value"...
By setting a new transform on the object (with X and Y of 0), you might
be resetting this "weird" condition...
If somebody has more insight/explanations over this, I would be
interested in knowing the end of it...
Thanks
Marcus
Ranj
"viliescu" <vili...@discussions.microsoft.com> wrote in message
news:2909AE87-AD1F-451F...@microsoft.com...