I have created a View call PhotoView with a PhotoviewModel it is bind to. in the view model I have define a commande as follow :
//Show info command
ShowInfoCmd = new RelayCommand<RoutedEventArgs>(
(e) =>
{
if (IsInfoOpen)
{
Messenger.Default.Send(new Knauf.Message.HidePhotoInfo(this));
IsInfoOpen = !IsInfoOpen;
}
else
{
Messenger.Default.Send(new Knauf.Message.ShowPhotoInfo(this));
IsInfoOpen = !IsInfoOpen;
}
},
(e) => HasMoreInfo
);
The message type I send is a custom message.
For each photo I have I create a new PhotoViewModel and then create an instance of PhotoView. So each PhotoView has a button bind to the ShowInfoCmd in the PhotoViewModel.
What is actually happening is that If I click on the button on one Instance of PhotoView only that instance should receive the command.
Actually all instance receive the command. how can I avoid this ?
thnaks for help regards serge
Solve, it was raise on wrong instance