c# - Kinect detect handpointer hover on tilebutton -
i'm trying detect hovering (like onmouseover) on tilebutton, has build in hand pointer. cannot find build in event , i've tried gives me exception ( invocation of constructor on type 'microsoft.kinect.toolkit.controls.kinectuserviewer' matches specified binding constraints threw exception'
xaml giving exception:
<k:kinectuserviewer k:kinectregion.kinectregion="{binding elementname=kinectregion}" horizontalalignment="center" height="150" verticalalignment="top" width="150" canvas.left="820"/> <k:kinectregion kinectsensor="{binding kinect, elementname=kinectsensorchooser1}" height="919" width="1920" x:name="kinectregion" canvas.top="151"> the buttons automatically created forloop.
cs:
public static readonly routedevent handpointerenterevent = eventmanager.registerroutedevent( "handpointerenter", routingstrategy.direct, typeof(eventhandler<handpointereventargs>), typeof(kinectregion)); public static readonly routedevent handpointerleaveevent = eventmanager.registerroutedevent( "handpointerleave", routingstrategy.direct, typeof(eventhandler<handpointereventargs>), typeof(kinectregion)); ... public mainwindow() { initializecomponent(); kinectregion.addhandpointerenterhandler(this, this.onhandpointerenter); kinectregion.addhandpointerleavehandler(this, this.onhandpointerleave); .... private void onhandpointerenter(object sender, handpointereventargs handpointereventargs) { this.close();//trying see if works } private void onhandpointerleave(object sender, handpointereventargs handpointereventargs) { this.close();//trying see if works } what i've tried comes link: hand on button event in kinect sdk 1.7
however, if remove first 2 lines (public static), program works hover isnt detected. lines it'll throw exception.
basically i'm trying first detect hover , close program (gives me idea if works or not).
thanks help
your edition
kinectregion.addhandpointerenterhandler(this, this.onhandpointerenter); kinectregion.addhandpointerleavehandler(this, this.onhandpointerleave); first parameter 'this' means form
but needs "kinecttilebutton"
my edition - works.
kinectregion.addhandpointerenterhandler(this.kinecttilebuttonname, this.onhandpointerenter); kinectregion.addhandpointerleavehandler(this.kinecttilebuttonname, this.onhandpointerleave);
Comments
Post a Comment