private void Animation_Completed(object sender, EventArgs e) { AnimationTimeline timeline = (sender as AnimationClock).Timeline; Grid uIElement = Storyboard.GetTarget(timeline) as Grid; positionDic[uIElement.Name].CanvasLeft = Canvas.GetLeft(uIElement); positionDic[uIElement.Name].CanvasTop = Canvas.GetTop(uIElement); uIElement.BeginAnimation(Canvas.LeftProperty, null); Canvas.SetLeft(uIElement, positionDic[uIElement.Name].CanvasLeft); //Border b=null; //foreach (var item in borderMap) //{ // var border = item.Key; // if (Canvas.GetLeft(uIElement) == Canvas.GetLeft(border) && // Canvas.GetTop(uIElement) == Canvas.GetTop(border)) // { // b = border; // } //} //if (b != null) //{ // borderMap[b] = uIElement; //} }