Attach method on ViewModel to events in WPF
How can bind an event on a WPF Control to a method on my ViewModel?

I have a ViewModel:

    class MyViewModel {
        public string MyText { get; set; }
        public void MyMouseHandleMethod(object sender, EventArgs e) { }
    }

In a DataTemplate I've got:

    <TextBlock Text="{Binding Text}">

Now I would like to attach a method on my ViewModel to the TextBlock, something like:

    <TextBlock Text="{Binding MyText}" MouseUp="{Binding MyMouseHandleMethod}">

I cannot figure out how to do this without creating a callback in the Code-behind.


Attach method on ViewModel to events in WPF
===

How can bind an event on a WPF Control to a method on my ViewModel?

I have a ViewModel:

    class MyViewModel {
        public string MyText { get; set; }
        public void MyMouseHandleMethod(object sender, EventArgs e) { }
    }

In a DataTemplate I've got:

    <TextBlock Text="{Binding Text}">

Now I would like to attach a method on my ViewModel to the TextBlock, something like:

    <TextBlock Text="{Binding MyText}" MouseUp="{Binding MyMouseHandleMethod}">

I cannot figure out how to do this without creating a callback in the Code-behind.

