winrt xaml - How to keep rotating image or canvas -



winrt xaml - How to keep rotating image or canvas -

this code fire 1 time rotate canvas. why not rotate when user press rotate button sec time?

--update button <appbarbutton x:name="camrotate90" margin="0,2,2,0" width="90" height="90" fontsize="16" label="rotate-right" icon="rotate" click="camrotate90_click"> </appbarbutton> <canvas x:name="canvas" margin="231,28,321,111" width="700" height="525" grid.row="0" grid.rowspan="3" grid.column="0"> <image canvas.top="0" canvas.left="0" margin="0" x:name="preview" width="700" height="525" stretch="uniformtofill" > </image> </canvas> private void camrotate90_click(object sender, routedeventargs e) { compositetransform ct = new compositetransform(); ct.centerx = canvas.actualwidth / 2; ct.centery = canvas.actualheight/2; ct.rotation = 90; canvas.rendertransform = ct; }

instead of replacing rendertransform each time create rendertransform 1 time , reuse it:

xaml:

<canvas x:name="canvas" margin="231,28,321,111" width="700" height="525" grid.row="0" grid.rowspan="3" grid.column="0"> <canvas.rendertransform> <compositetransform /> </canvas.rendertransform> <image canvas.top="0" canvas.left="0" margin="0" x:name="preview" width="700" height="525" stretch="uniformtofill" > </image> </canvas>

code:

private void camrotate90_click(object sender, routedeventargs e) { compositetransform ct = canvas.rendertransform compositetransform; if (ct != null) // create sure { ct.centerx = canvas.actualwidth / 2; ct.centery = canvas.actualheight / 2; ct.rotation += 90; } }

winrt-xaml

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -