Anele Ngqandu

Anele Ngqandu

  • 1.8k
  • 346
  • 14.3k

Get selected items from listview object sender xamarin

Nov 13 2017 2:47 AM
Hi
 
Using ListView Behaviors, How do I get values/object of selected item or selected row?
 
Below is what i tried and I get a property that says "SelectedItem" but i cant access it. What am I missing?
 
<ListView.Behaviors>
<behaviors:EventHandlerBehavior EventName="ItemSelected">
<behaviors:InvokeCommandAction Command="{Binding OnItemSelected}" /> </behaviors:EventHandlerBehavior> </ListView.Behaviors>
 
//constructor
public BurialsViewModel()
{
_onItemSelected = new Command(OnSelectedItem);
}
 
//ViewModel
ICommand _onItemSelected;
public ICommand OnItemSelected{ get { return _onItemSelected; } }
void OnSelectedItem(object sender) { //I need values from sender }