Answered by:
listview selected index data row

Question
-
using vs 2012 c#
I have a listview that contains a datatable, I added a binding source and bound some text boxes, how do I get the selected row when the listview is clicked.
Wednesday, December 4, 2013 3:25 PM
Answers
-
Hi,
you can use the SelectedItem property
<ListView ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
public MyItem SelectedItem { get; set; } public List<MyItem> Items { get; set; }
or for the index the SelectedIndex property.
<ListView ItemsSource="{Binding Items}" SelectedIndex="{Binding SelectedIndex}">
public int SelectedIndex { get; set; }
Chris
Code Samples: Code Samples
Chrigas Blog: Chrigas Blog
Wednesday, December 4, 2013 10:02 PM
All replies
-
Hi,
you can use the SelectedItem property
<ListView ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
public MyItem SelectedItem { get; set; } public List<MyItem> Items { get; set; }
or for the index the SelectedIndex property.
<ListView ItemsSource="{Binding Items}" SelectedIndex="{Binding SelectedIndex}">
public int SelectedIndex { get; set; }
Chris
Code Samples: Code Samples
Chrigas Blog: Chrigas Blog
Wednesday, December 4, 2013 10:02 PM -
Hi CanAnn,
Here is a similar question, you can refer to :http://stackoverflow.com/questions/18355934/listview-getting-the-text-of-the-selected-row
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Thursday, December 5, 2013 5:01 AM -
please find the link below
http://www.c-sharpcorner.com/uploadfile/mahesh/working-with-listview-in-c-sharp/
Please mark as answer, if you find this post helpful. Thanks Deepak Kalra
- Proposed as answer by Deepak Kalra Thursday, December 5, 2013 7:00 AM
Thursday, December 5, 2013 7:00 AM