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
Setting focus on next element in XamDataGrid


On tabbing into the second cell of the XamDataGrid i want that the element which is in the cell should get focus and not the outer cell. I am using ValueEditor in the style. I also tried CellValuePresenter but still the focus remains on the outer cell and not on the element.

I have developed a sample application. Attached is the same. Please have a look and suggest what can be done.



  • 29910
    Verified Answer
    Offline posted

    Hello Abdi,

    I have been investigating into the sample project you have provided, and I am under the impression that in the sample project, you are trying to have the Button be focused. If my impression on this is correct, I have a couple of recommendations for you on this matter.

    My best recommendation on this is to utilize a TemplateField and a DisplayTemplate for that TemplateField rather than re-templating the ValueEditor element for your Field to place a Button inside. A TemplateField was built so that you can effectively put any element you want inside without needing to re-template elements of the grid. I have tried this using the sample project and the Button focuses automatically using this method. You can read about this method at this documentation article.

    I am attaching a sample project to demonstrate this, along with a workaround using the ValueEditor re-templating using the CellActivated event of the grid, if for some reason you are looking to continue with that instead of using the TemplateField. I would highly recommend using a TemplateField for this, though.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children