Search code examples
wpfwpf-controlstelerik-grid

Put RadGrid in insert mode via command


I need to put the grid in insert mode when a user clicks an Add button (he doesn't want the click on the grid, but an external button)

Since I've developed all my app using MVVM pattern, I was wondering if there's a way I can put the grid in insert mode via command

Any suggestion? Thanks


Solution

  • The RadGridView comes with some built in commands, one of which is begininsert.

    There's sample code shows how to invoke such commands on telerik's site:

    https://docs.telerik.com/devtools/wpf/controls/radgridview/commands/overview

    Since this is manipulating the state of a control then you can use code behind in the view and a click event without "breaking" mvvm. You can't run automated tests on this processing using just the viewmodel anyhow - since the viewmodel isn't going to know anything about a gridview, let alone any mode it's in.