Hi,
I've a hierarchical XamDataGrid and would like that when the user double-clicks on a row that's not a root I take some action. Ideally I'd like to attach a blend Interaction.Triggers with an EventTrigger that calls a InvokeCommandAction which will invoke a command on my ViewModel, but if there's a way to directly invoke a command on mouse-double-click that's also fine :)
Again, I don't want to register on the whole grid's double-click, but only for child records (or particular field layouts).
Any ideas how I can do this?
Thanks!
Hello,
To attach a double click handler, you can do in a style for the DataRecordPresenter for example. You can apply this style only for the nested records by applying the style at the nested FieldLayout's Settings->DataRecordPresenterStyle.
Hi Alex,
I believe you are referring to attaching a code-behind event handler, right? While this would work, I'd ideally like to be able to attach a behavior that calls a command in the viewmodel, or somehow call a command directly.
My current solution is to attach a behavior like ExecuteTypeFilteredCommandAction, which subscribes to the MouseDoubleClick event of the grid and looks if the ActiveItem is of a certain type, so that the command only gets executed for nested records. This works but it's a bit suboptimal :)
Maybe there's a better way?
Thanks