Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
700
Edit value with space in a templated XamCheckEditor
posted

Hey,

we are using a style for XamCheckEditor with a ControlTemplate that contains a checkbox:

  <Style TargetType="{x:Type igEditors:XamCheckEditor}" x:Key="ForensicsCheckboxStyle">
        <Setter Property="IsChecked" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:CellValuePresenter}}, Path=DataContext.DataItem.ForensicsChecked, Mode=TwoWay}"/>
        <Setter Property="IsThreeState" Value="False"/>
        <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:CellValuePresenter}}, Path=Field.Settings.AllowEdit}"/>
        <Setter Property="IsAlwaysInEditMode" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igEditors:XamCheckEditor}">                    
                    <CheckBox HorizontalAlignment="Center"                             
                              IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsChecked, Mode=TwoWay}"                                                                          
                              Background="Tomato"  
                              IsHitTestVisible="False" />                  
                </ControlTemplate>
            </Setter.Value>
        </Setter>       
    </Style>

We need this style to get a classic checkbox look:

With this style the checkbox can't be set with space by pressing Tab because the checkbox has no focus.    

We tried to set the focus in code but it doesn't work. 

Have you got an idea how we can fix this behavior?

Best Regards

Lukas