i have been developing simple application in c# uses kinect hand pointer controls.
in application have more 6 canvases,in every canvas have embedded kinect region. bind kinectsensor in mainwindow.cs kinectregions in canvases.
<canvas name=" canvas1" visibility="visible"> <k:kinectregion kinectsensor="{binding kinectsensor}" name="kinectregioncp"> // controls </canvas> <canvas name=" canvas1" visibility="hidden"> <k:kinectregion kinectsensor="{binding kinectsensor}" name="kinectregionap"> // controls </canvas> .........// more canvases
the problem ,even-though 1 canvas visible @ time,the cpu usage burst 90% other canvases actively using kinect region.
is there way bind sensor when particular canvas visible?
you set datacontext
based on visibility
of control. here example on canvas
. if have other controls on canvas
databound need apply style
k:kinectregion
.
<canvas name=" canvas1" visibility="visible"> <canvas.style> <style targettype="canvas"> <style.triggers> <trigger property="visibility" value="visible"> <setter property="datacontext" value="{binding}"/> </trigger> <trigger property="visibility" value="hidden"> <setter property="datacontext" value="{x:null}"/> </trigger> </style.triggers> </style> </canvas.style> <k:kinectregion kinectsensor="{binding kinectsensor}" name="kinectregioncp"> // controls
Comments
Post a Comment