storyboard - WPF Animation (changing multiple properties of single element at the same time) -



storyboard - WPF Animation (changing multiple properties of single element at the same time) -

i need animate multiple properties of 1 ui element @ same time.

for example, decreasing width , height of windows synchronously.

any idea?

doubleanimation widthanimation = new doubleanimation { = 0, duration = timespan.fromseconds(5) }; doubleanimation heightanimation = new doubleanimation { = 0, duration = timespan.fromseconds(5) }; storyboard.settargetproperty(widthanimation, new propertypath(window.widthproperty)); storyboard.settarget(widthanimation, this); storyboard.settargetproperty(heightanimation, new propertypath(window.heightproperty)); storyboard.settarget(heightanimation, this); storyboard s = new storyboard(); s.completed += fadeout_completed; s.children.add(widthanimation); s.children.add(heightanimation); this.beginstoryboard(s, handoffbehavior.snapshotandreplace, true);

it animations step step; height alter after width changes complete! :|

after looking @ code understand trying animate width , height of window simultenousely

but regret tell since window not actual wpf component platform component. content of window controllable expected via code, window not. such changes routed through pinvoke. , issue facing known issue , work around bit complex

one solution here, uses pinvoke animate window's height , width

animating wpf window width , height

here bug similar issue created @ microsoft, result (closed, won't fix)

https://connect.microsoft.com/visualstudio/feedback/details/715415/window-width-height-animation-in-wpf-got-broken-on-net-framework-4-0

extra

below sample not solving problem help cut down number of lines need perform such animations other elements. rewrite of code in less lines

doubleanimation anim = new doubleanimation { = 0, duration = timespan.fromseconds(5) }; border.beginanimation(border.heightproperty, anim); border.beginanimation(border.widthproperty, anim);

try code element except window, used border color filled

apologies overlooking window in code @ first sight

wpf storyboard wpf-animation doubleanimation

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -