1

I'm developing a WPF application that uses Kinect v2.0 for motion controls like grab-and-swipe and click. In this application, I have some elements:

  • A UserControl, which contains an Awesomium WebControl
  • A Window, which contains a button that creates the UserControl described above and puts it on the Window.

My problem is: although I can use the Kinect to click on the button, I can't use it to interact with the Web page loaded in the Awesomium WebControl. That is, I can't click on anything inside the WebControl, nor can I scroll the Web page.

How can I use the Kinect to interact with the WebControl?

Edit: Oops, sorry, forgot to post my code (first time asking, and it's very late here, I'm dead on my feet). Here it is:

When the button is clicked:

private void ButtonClick(object sender, RoutedEventArgs e)
    {
        Button senderButton = (Button)e.Source;
        string name = senderButton.Name;
        name = name.Remove(0, 1); //just getting some values
        int i = int.Parse(name); //same as above
        string url = newsUrl[i];
        var aux = (WebContentBrowser)Activator.CreateInstance(typeof(WebContentBrowser));
        Uri webUrl = new Uri(url);
        aux.webBrowser.Source = webUrl;
        this.navigationRegion.Content = aux;
        this.menuButton.Visibility = System.Windows.Visibility.Visible;
        kinectRegion.Focus();
        this.kinectRegion.InputPointerManager.CompleteGestures();           
        //Window windowWeb = new WindowWeb(url);
        //windowWeb.Show();
    }

The XAML of the Windows mentioned on the question:

<Window x:Class="MuralDigitalKinectWPF.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:k="http://schemas.microsoft.com/kinect/2014"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:MuralDigitalKinectWPF"
    mc:Ignorable="d"
    Title="Mural Digital" Height="720" Width="1366" WindowStartupLocation="CenterScreen" WindowState="Maximized" >
<Window.Background>
    <SolidColorBrush Color="DimGray"/>
</Window.Background>

<k:KinectRegion x:Name="kinectRegion">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Margin="10 0 10 20">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Button x:Name="menuButton" Background="DimGray" Height="68" Width="68" Margin="0,0,0,0" Padding="0 0 0 0" Visibility="Hidden" Click="menuButton_Click">
                <Image Height="64" Width="64" Visibility="Visible" Source="Images/back-navigational-arrow-button-pointing-to-left.png" Margin="0 0 0 0"></Image>
            </Button>
            <k:KinectUserViewer Grid.Column="1" HorizontalAlignment="Center" Height="100" VerticalAlignment="Top"></k:KinectUserViewer>
            <TextBlock Grid.Column="1" Foreground="White" HorizontalAlignment="Right" Margin="0 0 -1 0" VerticalAlignment="Bottom" FontSize="24">Mural Digital</TextBlock>
        </Grid>

        <ContentControl Grid.Row="1" x:Name="navigationRegion">
            <Grid x:Name="kinectRegionGrid" Margin="05 05 05 05">
                <ScrollViewer Grid.Row="0"
                              HorizontalScrollBarVisibility="Auto"
                              VerticalScrollBarVisibility="Disabled"
                              k:KinectRegion.IsScrollInertiaEnabled="True">
                    <ItemsControl Grid.Row="0" Name="itemsControl">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel VerticalAlignment="Top" Orientation="Horizontal" Margin="0 0 0 0" Button.Click ="ButtonClick" ></WrapPanel>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>

                </ScrollViewer>
            </Grid>
        </ContentControl>

    </Grid>

</k:KinectRegion>

The XAML of the UserControl:

<UserControl xmlns:awe="http://schemas.awesomium.com/winfx"  x:Class="MuralDigitalKinectWPF.WebContentBrowser"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:k ="http://schemas.microsoft.com/kinect/2014"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:MuralDigitalKinectWPF"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="kinectRegionGrid">
    <awe:WebControl x:Name="webBrowser" />            
</Grid>

0 Answers0