c# - How do I get Silverlight animation/application to work as well/the same in WPF? -


i found silverlight dashboard demo works great @ http://blog.allaboutprogress.com/2010/04/silverlight-dashboards-part-i/

however, want application work in wpf. created project in silverlight , got run, copied on files wpf application.

after minor tweak got working, same way, animation looks terrible compared silverlight version.

1) in silverlight moves around smoothly no matter how large form. in wpf animation gets erratic when there animation going on, , tends perform worse larger containing window.

2) in silverlight both pod being dragged , other pods need ot of way animate smoothly. in wpf, pod being moved not move while drag mouse, other pods still out of way drag mouse around. when relase mouse, pod move location realeased mouse at. plus doesn't take long other pods' animation start looking bad (like graphics driver overwhelmed).

why behavior radically different same xaml , code between wpf , silverlight, , how can wpf animate same beautiful way original silverlight code does?

here's change had make wpf version work.

so first created way did on silverlight , gave me error when first started it:

{"'system.windows.media.animation.doubleanimation' cannot use default origin value of 'nan'."}

so, fixed updating the

void translateanimation(uielement element, double newleft, double newtop, double ts) 

method, follwoing code @ start of method:

void translateanimation(uielement element, double newleft, double newtop, double ts)   {    if (double.isnan(canvas.getleft(element)))    {     element.setvalue(canvas.leftproperty, convert.todouble(0));    }     if (double.isnan(canvas.gettop(element)))    {     element.setvalue(canvas.topproperty, convert.todouble(0));    }    ... 

this made code start/run without crashing.

this method creates storyboard , double animation object, hooks pod, , tells storyboard begin. called in loop, once each of moving pods that isn't being dragged mouse.

that's strange behaviour, guess has 1 of following:

social.msdn: smooth, lag occurring during wpf animation

allowtransparency problem

like first link describes, try use compositiontarget.rendering instead of storyboard in xaml. check example out: how to: render on per frame interval using compositiontarget

furthermore, there nice blog post morten nielsen explains differences between silverlight , wpf: sharpgis.net


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -