This project is read-only.

So how can I hook up a RoutedEvent to a method in a ViewModel?

I borrowed a solution from MvvmLight here, as it fits very well.

Add these namespaces to your Xaml:


You'll of course, have to add a reference to System.Windows.Interactivity.  I included a version with NoMvvm.

Add this Xaml, to hook up a "Loaded" event to a method named "Refresh":

        <i:EventTrigger EventName="Loaded">
            <nomvvm:EventToCommand Command="{Binding Refresh}" />

Easy peasy.

Last edited Aug 4, 2011 at 3:52 AM by jonathanpeppers, version 5


No comments yet.