8 Answers, 1 is accepted
You could call SelectionChanged on the RadGridView, and in the code behind of the controller invoke the event on your view model as appropriate.
I've also put a button in my RadGridViews before that invokes a command from my view models if that helps you at all:
I want to do it in code behind. I have a mouse down event when I click a row with mouse.
I want to change the color then. So I thought to raise an event for that. Not sure whether we can do it since we already have an event. Basically the question can be divided two parts. One select row with mouse, two once we get the row, then to raise an event.
Thanks for help.
This approach may work, can't really test it myself, as I have other behavior in my grid which is preventing the event from ever firing:
Let me know if that works for you.
No. It is not working. The code doesn't reach the inside after the mouse left button down.
Regarding the original question in the thread - How to raise an event in ModelView class If I select a row - Please check the following article from our documentation - EventToCommandBehavior.
However, as far as I understand, your requirement is to change the row`s background when the row is selected. The best way to achieve this is to predefine the template of the GridViewRow. You need to modify the Border element named "Background_Selected" in the VisualStates with the desired color. Please, check the following article - Styling Rows.
You can also achieve the behavior through Style Triggers:
The recommended approach is modifying the ControlTemplate, though.
Please update the thread if you have some difficulties.
Telerik by Progress
Please excuse me for the misleading information regarding the Triggers as they are not supported in Silverlight.
Did you try the other option from my previous reply? I am here providing a project with the desired functionality. Please review it and consider such approach at your end as well.
Telerik by Progress