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
14517
Execute Command In ViewModel on Double Click
posted

Hello,

In the following blog post

http://blogs.infragistics.com/blogs/devin_rader/archive/2011/06/01/using-behaviors-to-synchronize-selected-items-of-infragistics-silverlight-controls-to-a-viewmodel.aspx

it describes how to use behaviors to sync up properties in your ViewModel . This method can similarly be used in both Silverlight and WPF to add binding for command processing.

For example, by creating an ICommand Dependency Property in your Behavior you can then create a binding between a command in your ViewModel and a control’s event.

I have attached a sample demonstrating this using Relay Commands and Behavior to execute a command in the ViewModel on the Double Click event of the XamDataGrid.

Sincerely,

Valerie

Developer Support Engineer

Infragistics

www.infragistics.com/support

SampleGrid.zip
Parents
  • 30
    posted

    Valerie,

    Thanks so much for the code sample. That's the exact pattern that I'm building out using the XamDataGrid so your code has gotten me pretty far down the road. I've run into a problem in my code that I'm hoping you've seen before or can maybe shed some light on what I'm doing wrong.

    As you can see in the attached screenshot, I'm getting a null object reference in the class included in your sample but I can't figure out why. To be clear, your class works in your sample so I'm trying to figure out what I missed in plugging it into my app. At the top of the screenshot I show where the ClickedCmdProperty is set (from the binding in my XAML page) but when ClickedCmd is referenced it is null. The screenshot doesn't show it but r.DataItem has precisely the record of data that I want to process. It's ClickedCmd that doesn't have a value. Any ideas as to what would cause that behavior?

    Screenshot of debugger

    Best regards,

    Dempsey

Reply Children