I use the MVVMLight EventToCommand to hook up a command to the MouseEnter event:
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding DragHandleMouseEnterCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
How do I unhook the handler programatically?
viewObject.MouseEnter -= viewObject.GetViewModel().DragHandleMouseEtnerCommand gives a type mismatch error.
UPDATE: Looks like I need to use the viewObject.Triggers collection, somehow. Suggestions...?
UPDATE II: Nope, nothing in the Triggers collection....
Thanks for any insight...
Why not simply set DragHandleMouseEnterCommand to null in your viewmodel?
The trigger would remain but it wouldn't fire anything. If you wanted to reactivate the Command you'd just need to "new up" a new one and bind it to the property and call RaisePropertyChanged("DragHandleMouseEnterCommand").