1

I want to build a "gaze enabled" app, where most controls could be activated just using one's gaze. Doing that with a button is pretty easy. Just add gaze:GazeInteraction.Interaction = Enable to the button in XAML and when I dwell at it it's as if I've clicked on it with the cursor.

But it doesn't work with a TextBox that way. Maybe I should do something from code-behind? I'm still a beginner with C# and I've already read this, but I coldn't understand it well, so I used that instead.

Here's my code so far:

<Page
    x:Class="gazebox.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:gazebox"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:gaze="using:Microsoft.Toolkit.Uwp.Input.GazeInteraction"

    Width="500" Height="250">

    <Grid Background="#FF1A3163" VerticalAlignment="Stretch">
        <Button Content="Exit" HorizontalAlignment="Right" Margin="0,0,25,0" Height="100" Width="100" Background="#66E8E5E5" gaze:GazeInput.Interaction="Enabled"/>
        <TextBox x:Name="textBox" Text="" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Height="50" Width="200" Margin="25,150,0,0" gaze:GazeInput.Interaction="Enabled"/>
        <TextBox x:Name="textBox2" Text="" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Height="50" Width="200" Margin="25,50,0,0"/>

    </Grid>
</Page>

and my .cs file is pretty much empty yet.

So, how do I make the TextBox(or any other element for that matter) be clicked when I dwell at it?
Any help would be greatly appreciated.

Pavel

p.s. I have a Tobii eye tracker

Pako
  • 11
  • 3

0 Answers0