0

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

serge
  • 391
  • 5
  • 24
  • Have you verified that all instances get a call to the command? Or could it be that the class receiving the `Knauf.Message.HidePhotoInfo` message doesn't know from which ViewModel it came? – Daniel Hilgarth Aug 17 '12 at 10:50
  • Solve, it was raise on wrong instance – serge Dec 29 '12 at 09:08

1 Answers1

0

Solve, it was raise on wrong instance

serge
  • 391
  • 5
  • 24