how to get selected datagrid row items ?
-
-
Hi, I have a datagrid(using WPF) and miltiple row selection is allowed. How to get multiple selected items in MVVM pattern? It is easy to get this in code behind file? But in MVVM pattern codebehind file doesn't contains the much code. Many thanks.
There are two parts to this answer. The first part is that you should use a Command to set an IsSelected property on each item in your collection. The second part compensates for the fact you can't bind to a command on the Selected event. To get round this you need to use an EventToCommand Blend Behaviour. Laurent Bugnion has a fine sample in MVVM Light.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
There are two parts to this answer. The first part is that you should use a Command to set an IsSelected property on each item in your collection. The second part compensates for the fact you can't bind to a command on the Selected event. To get round this you need to use an EventToCommand Blend Behaviour. Laurent Bugnion has a fine sample in MVVM Light.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility