XAMARIN – GET SELECTED ITEMS FROM LISTVIEW IN ANDROID
In this post we would see, how to get the selected items from the screen activity where a list of options are displayed.
The following is the layout for displaying the Multiple Selectable ListView with a button.
Now we would bind data to the ListView.
Also we would make it Multiple Selectable with SelectOption as Multiple.
And we would subscribe to the click event of the Button.
In the button click event handler, we would do as following to get the selected data out of ListView.
ShowAlert is a helper method to show alerts with easy, here is the code for that too.
Now run the application. You could see the fixed
As on button click, the selected items positions with respect to the collection is displayed.
Hope this post helps, thanks for Reading.
Full Source Code: Click Here
No comments:
Post a Comment