2
我試圖檢測到在tilebutton上懸停(如onmouseover),但它必須是構建在手形指針。我無法在事件中找到構建,我試過這個,但它給了我一個異常(匹配指定綁定約束的類型'Microsoft.Kinect.Toolkit.Controls.KinectUserViewer'上的構造函數的調用拋出了一個異常'Kinect檢測手勢指針懸停在tilebutton
XAML給予例外:
<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">
的按鈕會自動通過for循環創建
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 to see if it works
}
private void OnHandPointerLeave(object sender, HandPointerEventArgs handPointerEventArgs)
{
this.Close();//Trying to see if it works
}
我已經試過來源於此鏈接: Hand over button event in Kinect SDK 1.7
但是,如果我刪除了前兩行(公共靜態),該程序的作品,但懸停心不是檢測。用這些線會引發異常。
基本上我第一次嘗試檢測懸停,然後關閉該程序(如果它的工作與否,給了我一個好主意)。
感謝您的幫助
好吧,我現在試圖用'ButtonBase.Click'和'ButtonBase.MouseEnter'這個工作,除了的MouseEnter,的MouseEnter需要由handpointer代替...... – SanderW
我有同樣的問題。你有沒有找到任何解決方案,它適用於它?非常感謝! – VilemRousi