Programatically select listview element in MVVM

Liuk88Liuk88 ITMember ✭✭✭

Hello guys, I have a page divided in two sections:

  • one that display a map with a list of Pins (markers)
  • one that display a listview with the Pins names

Since Im using MVVM, in the listview xaml I just have a binding for the ItemsSource property
After i populate the ItemSource with a list in MVVM, I create the pins, assigning pin.Tag = listElement.Id so I can keep the reference with an id between listview elements and Pins.
Now there is the problem, when i click a Pin, in the eventHandler, Im trying to select and highlight the listview corresponding element (using the id of the marker to find the right element). How can i do this? Im trying with selectedItem property but with no results..
Thanks a lot!

Best Answer

  • Liuk88Liuk88 IT ✭✭✭
    Accepted Answer

    Solved, I just missed the Mode=TwoWay in XAML :)

Answers

  • Liuk88Liuk88 ITMember ✭✭✭
    Accepted Answer

    Solved, I just missed the Mode=TwoWay in XAML :)

  • jezhjezh Member, Xamarin Team Xamurai

    Congratulations, your efficiency is very high.

Sign In or Register to comment.