Home › Forums › Software Development › [C# WPF] Gazeable Button
Tagged: C# WPF Button Gazeable Click
- This topic has 3 replies, 2 voices, and was last updated 7 years, 7 months ago by
Grant [Tobii].
Viewing 4 posts - 1 through 4 (of 4 total)
- AuthorPosts
- 28/12/2016 at 20:37 #6113
Anonymous
InactiveHi! 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
28/12/2016 at 20:58 #6114Anonymous
InactiveThis 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… 🙁
30/01/2017 at 21:45 #6279Anonymous
InactiveSolved.
30/01/2017 at 22:05 #6280Grant [Tobii]
KeymasterHi @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.
- AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.