c# - detect which item is selected by the hand pointer (not mouse) in listbox wpf -
is there similar way detect item in listbox wpf had been selected kinect v2 hand pointer? tried use selected trigger on listbox , error says: 'listbox' not contain definition 'selected' , no extension method 'selected' accepting first argument of type 'listbox'
<listbox x:name="listbox" verticalalignment="bottom" itemtemplate="{dynamicresource itemtemplate11}" itemssource="{binding collection}" selected="listbox_selected"> <listbox.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal"/> </itemspaneltemplate> </listbox.itemspanel> </listbox> public partial class mainwindow { /// <summary> /// initializes new instance of <see cref="mainwindow"/> class. /// </summary> public mainwindow() { this.initializecomponent(); kinectregion.setkinectregion(this, kinectregion); app app = ((app)application.current); app.kinectregion = kinectregion; // use default sensor this.kinectregion.kinectsensor = kinectsensor.getdefault(); } private void listbox_selected(object sender, routedeventargs e) { messagebox.show(listbox.selectedindex.tostring()); } }
huh? listbox has selectionchanged event , selecteditem property. selected event on listboxitem. trap selectionchanged event on listbox itself.
Comments
Post a Comment