Listview selected row and command

NessaNessa DEMember ✭✭

does anyone know how i know which row is being tapped/selected in listview?
and how can i do a command for listview?
both didnt really work for me


  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @Nessa,

    I assume Your listview is bound to Observable Collection (of a specific type)

    <ListView ItemSelected="OnSelectedItem" /> (in non MVVM enviornment you get the selected item via this event)

    Or in MVVM way

    When your Model class is

    public class MyClassItem{
    public string MyClassItemProperty{get; set;}
    public string MyClassItemAnotherProperty{get; set;}

    and MyClassItemList is list or Observable Collection of MyClassItem

    ItemsSource="{Binding MyClassItemList}"
    SelectedItem="{Binding MyClassItem, Mode=TwoWay}" >
    <TextCell Text="{Binding MyClassItemProperty}" Detail="{Binding MyClassItemAnotherProperty}"/>

    Hope this helps,

    N Baua

Sign In or Register to comment.