2013-03-08 4 views
0

Canvas의 너비 속성 DoubleAnimation을하고 있습니다. 저는 캔버스를 크기의 1/5로 축소하려고합니다.너비의 DoubleAnimation이 축소되지 않습니다.

var widthAnimation = new DoubleAnimation(); 
widthAnimation.Duration = new TimeSpan(0,0,1); 
StoryBoard.SetTarget(widthAnimation, Canvas1); 
StoryBoard.SetTargetProperty(widthAnimation, new PropertyPath("Width")); 
widthAnimation.From = Canvas1.Width; 
widthAnimation.To = Canvas1.Width * .2; 

StoryBoard stb = new StoryBoard(); 
stb.Children.Add(widthAnimation); 
stb.Begin(); 

어쨌든 위의 애니메이션은 크기를 1/5로 축소하지 않습니다. 대신 캔버스를 확대합니다. 애니메이션이 재미있는 일을하는 모든 단서가 있습니까?

답변

0

캔버스가 뷰 박스에 싸여 있습니다. Viewbox 크기는 고정되었고 캔버스는 축소되었습니다. 텍스트가 확장되었습니다. 이유를 모르겠다. 그러나 Canvas가 아닌 Viewbox에 애니메이션을 적용하여 문제를 해결했습니다. 그리고 지금은 괜찮습니다.

관련 문제