Home Forums Software Development WPF problems with Behavior.GazeAware binding Reply To: WPF problems with Behavior.GazeAware binding

#2736
Martin Krizek
Participant

Hello Patrik,
Thanks for quick response.
If I use your example “GazeAwareElements”. Add to “EyeXGazeAwareButton” style these setters:

<Setter Property="Opacity" Value="0.5" />
 <Setter Property="eyeX:Behavior.GazeAware" Value="False" />

And this Animation to Style.Triggers:

<EventTrigger RoutedEvent="FrameworkElement.Loaded">
    <BeginStoryboard>
       <Storyboard AutoReverse="True" RepeatBehavior="Forever">
           <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(eyeX:Behavior.GazeAware)">
               <DiscreteBooleanKeyFrame KeyTime="0:0:1.5" Value="True" />
           </BooleanAnimationUsingKeyFrames>
           <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity">
               <SplineDoubleKeyFrame KeyTime="0:0:1.5" Value="0.5" />
               <SplineDoubleKeyFrame KeyTime="0:0:5.5" Value="1" KeySpline="0.75,0,0.5,1" />
           </DoubleAnimationUsingKeyFrames>
       </Storyboard>
    </BeginStoryboard>
 </EventTrigger>

For binding:
If you add for example CheckBox into Grid:
<CheckBox Name="MyCheckBox" Content="Allow gaze" IsChecked="True" />
And change StackPanel:

<StackPanel Grid.Row="1"
                    Grid.Column="1"
                    Style="{StaticResource EyeXGazeAwarePanel}"
                    eyeX:Behavior.GazeAware="{Binding ElementName=MyCheckBox, Path=IsChecked, UpdateSourceTrigger=PropertyChanged}">