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
65
CheckBox in Unbound Field - tab focus
posted

Is there a way to modify the "CheckBox in Unbound Field" demo so that moving into the checkbox column using Tab button would automatically focus on the checkbox instead of the CellValuePresenter? Otherwise the user has to use the mouse to click the checkbox instead of just pressing Space.

  • 138253
    Verified Answer
    Offline posted

    Hello abryte,

    Thank you for your post. I have been looking through it and I suggest you add the following code for CellActivated Event of your xamDataGrid:

    if (e.Cell.Field.Name == "MyField")
                {
                    CheckBox checkeditor = Utilities.GetDescendantFromType(CellValuePresenter.FromCell(e.Cell), typeof(CheckBox), false) as CheckBox;
                    if (checkeditor != null)
                    {
                        checkeditor.Focus();
                    }
                }
    

    Where MyField is the name of the Unbound Field with the CheckBox.

    Looking forward for your reply.