I want to bind Viewmodel command to Usercontrol's Routed Event. Here is the detailed explanation of what I have.
I have a User Control which have one Image (which shows image) and one Button at bottom (Button to remove Image). I am using a Usercontrol in a ListView.
In my Usercontrol's Code behind I have a RoutedEventHandler to remove the Image:
public event RoutedEventHandler RemoveImage;
In the window where I use this Usercontrol, I have put:
<uc:ucImageListItem x:Name="ImageListItem" RemoveImage="ImageListItem_RemoveImage" />
This code works correctly if My code to remove image is in code behind. but I want to Bind command of Viewmodel to RemoveImage RoutedEvent.
Probably like (not correct)
<uc:ucImageListItem x:Name="ImageListItem" RemoveImage="{binding CommandtoRemove}" />
How to achieve this?
I found something related to RoutedCommand or DependancyProperty, but could not find any proper way, How to use them.
Let me know if I need to further clear my question. Thanks in anticipation.