TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhilash J A
533
2.4k
597.8k
How to get row id from listview on click row in wpf c#.net ?
Dec 18 2016 5:49 AM
I have listview in wpf C#.net,
How can I get row id from this listview on click?
<
ListView
Height
=
"490"
HorizontalAlignment
=
"Left"
Name
=
"listView1"
VerticalAlignment
=
"Top"
Width
=
"780"
ItemsSource
=
"{Binding}"
IsSynchronizedWithCurrentItem
=
"True"
Margin
=
"10,48,0,10"
>
<
ListView.View
>
<
GridView
>
<
GridView.Columns
>
<
GridViewColumn
>
<
GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
CheckBox
Tag
=
"{Binding login_Id}"
/>
</
DataTemplate
>
</
GridViewColumn.CellTemplate
>
</
GridViewColumn
>
<
GridViewColumn
Width
=
"155px"
DisplayMemberBinding
=
"{Binding FirstName}"
>
<
GridViewColumn.Header
>
<
GridViewColumnHeader
Tag
=
"FirstName"
Click
=
"MenuItem_Click"
>
User Name
</
GridViewColumnHeader
>
</
GridViewColumn.Header
>
</
GridViewColumn
>
<
GridViewColumn
Width
=
"155px"
DisplayMemberBinding
=
"{Binding Computer_Name}"
Header
=
"PC-Names"
/>
<
GridViewColumn
Width
=
"154px"
DisplayMemberBinding
=
"{Binding IP_Address}"
Header
=
"IP Adress"
/>
<
GridViewColumn
Width
=
"153px"
DisplayMemberBinding
=
"{Binding countID}"
>
<
GridViewColumn.Header
>
<
GridViewColumnHeader
Tag
=
"countID"
Click
=
"MenuItem_Click"
>
Documents Scanned
</
GridViewColumnHeader
>
</
GridViewColumn.Header
>
</
GridViewColumn
>
<
GridViewColumn
Width
=
"153px"
DisplayMemberBinding
=
"{Binding LogInTime}"
>
<
GridViewColumn.Header
>
<
GridViewColumnHeader
Tag
=
"LogInTime"
Click
=
"MenuItem_Click"
>
Last Login
</
GridViewColumnHeader
>
</
GridViewColumn.Header
>
</
GridViewColumn
>
</
GridView.Columns
>
</
GridView
>
</
ListView.View
>
<
ListView.ItemContainerStyle
>
<
Style
TargetType
=
"ListViewItem"
>
<
EventSetter
Event
=
"PreviewMouseLeftButtonDown"
Handler
=
"ListViewItem_PreviewMouseLeftButtonDown"
/>
</
Style
>
</
ListView.ItemContainerStyle
>
</
ListView
>
I have tried,
private
void
ListViewItem_PreviewMouseLeftButtonDown(
object
sender, MouseButtonEventArgs e)
{
//Here How can I get id ?
}
Reply
Answers (
2
)
Recursive call to Automation Peer API is not valid
bind checkboxlist in wpf using entity framework code First