Home Forums Software Development [C# WPF] Gazeable Button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6113
    Anonymous
    Inactive

    Hi! I am sorry that I am posting another question, but somehow i don’t have a clue how to implement to provoke a “click” just by looking at a button.

    I have read the manual and already applied this one:

    <Window ...
         xmlns:eyeX="clr-namespace:EyeXFramework.Wpf;assembly=EyeXFramework"
          ... >     
         <Grid>         
              <Button ...                 
                   eyeX:Behavior.Activatable="Default"    
                   eyeX:Behavior.Activate="Button_OnEyeXActivate">Click me!
              </Button>     
         </Grid> 
     </Window>

    In my Project I have done it in this way:
    Style-Tags:

    <Style x:Key="EyeXActivatableButtonStyle" BasedOn="{StaticResource ButtonStyle}" TargetType="Button">
                
                <Setter Property="eyeX:Behavior.Activatable" Value="Default" />
                <EventSetter Event="eyeX:Behavior.Activate" Handler="Button_OnEyeXActivate" />
            </Style>

    And the Button itself:

    <Grid  Grid.Row="1">
                <Border  Style="{StaticResource buttonBorder}" Background="Black" CornerRadius="4"/>
                <Button Name="button_1" Background="WhiteSmoke" BorderThickness="1" 
                        Click="button_Click"
    				>1</Button>
            </Grid>

    My Handler-method:

    private void Button_OnEyeXActivate(object sender, RoutedEventArgs e)
            {
                var button = sender as Button;
                if (null == button) { return; }
                
                button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, button));
                
            }

    My simple Click -method:

     private void button_Click(object sender, RoutedEventArgs e)
            {
                Button button = sender as Button;
                button.Background = Brushes.Blue;
                
            }

    I am sorry for the amount of code in this post, but maybe I am just overlooking something.

    schuetzi

    #6114
    Anonymous
    Inactive

    This is the right Button XAML definition:

    <Grid  Grid.Row="1">
                <Border  Style="{StaticResource buttonBorder}" Background="Black" CornerRadius="4"/>
                <Button Name="button_1" Background="WhiteSmoke" BorderThickness="1"    
                        Style="{StaticResource EyeXActivatableButtonStyle}"
                        Click="button_Click"
    				>1</Button>
            </Grid>

    But it is still not working… 🙁

    #6279
    Anonymous
    Inactive

    Solved.

    #6280
    Grant [Tobii]
    Keymaster

    Hi @schuetzi, thank you for the update. It would be great to know the source of the issue you were facing for the benefit of other users.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.