<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-6127132400597215190.post658150003039419606..comments</id><updated>2010-03-01T07:47:46.080-08:00</updated><title type='text'>Comments on Mike's Code Blog: WPF ListView - Getting the Clicked Item</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.nostatic.org/feeds/658150003039419606/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html'/><author><name>Mike</name><uri>http://www.blogger.com/profile/13599208082890099005</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-1073522724575045299</id><published>2009-12-04T20:33:21.873-08:00</published><updated>2009-12-04T20:33:21.873-08:00</updated><title type='text'>Great post!</title><content type='html'>Great post!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1073522724575045299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1073522724575045299'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1259987601873#c1073522724575045299' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-3826027891472744230</id><published>2009-12-02T10:45:42.366-08:00</published><updated>2009-12-02T10:45:42.366-08:00</updated><title type='text'>Or.. 


        private void appList_MouseDoubleCl...</title><content type='html'>Or.. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        private void appList_MouseDoubleClick(object sender, RoutedEventArgs e) {&lt;br /&gt;            ListViewItem app = (ListViewItem)appList.Items[appList.SelectedIndex];&lt;br /&gt;            MessageBox.Show(&amp;quot;you selected: &amp;quot; + app.Content);&lt;br /&gt;        }</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/3826027891472744230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/3826027891472744230'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1259779542366#c3826027891472744230' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-1849172701723258903</id><published>2009-09-30T08:19:50.993-07:00</published><updated>2009-09-30T08:19:50.993-07:00</updated><title type='text'>You can use this as well:

http://social.msdn.micr...</title><content type='html'>You can use this as well:&lt;br /&gt;&lt;br /&gt;http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/681dea50-6bd2-4676-8161-14416386778d</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1849172701723258903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1849172701723258903'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1254323990993#c1849172701723258903' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-286641836272143580</id><published>2009-01-11T17:03:23.061-08:00</published><updated>2009-01-11T17:03:23.061-08:00</updated><title type='text'>I'm assuming you mean to use a binding to TheSelec...</title><content type='html'>I'm assuming you mean to use a binding to TheSelectedItem, but anyway that wouldn't work in my particular case for at least two reasons:&lt;BR/&gt;&lt;BR/&gt;1. I'm using a multi-selected ListView (SelectionMode of Multiple), so SelectedItem is meaningless.&lt;BR/&gt;&lt;BR/&gt;2. I only want to act in response to mouse double-clicks, not selection.&lt;BR/&gt;&lt;BR/&gt;Responding to a selection is easy, but it isn't what I'm trying to do. In any case, if you want take action on a selection change, a better way to do that is to use the SelectionChanged event.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/286641836272143580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/286641836272143580'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1231722203061#c286641836272143580' title=''/><author><name>Mike</name><uri>http://www.blogger.com/profile/13599208082890099005</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='10796613826403701185'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-2263656323768318402</id><published>2009-01-11T16:10:32.578-08:00</published><updated>2009-01-11T16:10:32.578-08:00</updated><title type='text'>That's overly complex.Why would you do that?If you...</title><content type='html'>That&amp;#39;s overly complex.&lt;BR/&gt;&lt;BR/&gt;Why would you do that?&lt;BR/&gt;&lt;BR/&gt;If you have a listview, just do&lt;BR/&gt;&lt;BR/&gt;&amp;lt;ListView SelectedItem=&amp;quot;TheSelectedItem&amp;quot; ... &amp;gt;&lt;BR/&gt;&lt;BR/&gt;and in the setter for TheSelectedItem do what you want with it.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/2263656323768318402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/2263656323768318402'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1231719032578#c2263656323768318402' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-7844887363672706311</id><published>2008-12-14T12:04:35.666-08:00</published><updated>2008-12-14T12:04:35.666-08:00</updated><title type='text'>UsingMyDataItemType item = (MyDataItemType)((ListV...</title><content type='html'>Using&lt;BR/&gt;&lt;BR/&gt;MyDataItemType item = (MyDataItemType)((ListViewItem)dep).DataContext&lt;BR/&gt;&lt;BR/&gt;instead of&lt;BR/&gt;&lt;BR/&gt;MyDataItemType item = (MyDataItemType)MyListView.ItemContainerGenerator.ItemFromContainer(dep);&lt;BR/&gt;&lt;BR/&gt;is a bit more straight forward but may only work, if data source binding is used for the list view.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/7844887363672706311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/7844887363672706311'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1229285075666#c7844887363672706311' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-2396935379589999174</id><published>2008-12-04T11:25:05.948-08:00</published><updated>2008-12-04T11:25:05.948-08:00</updated><title type='text'>higreat code tnx!</title><content type='html'>hi&lt;BR/&gt;great code tnx!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/2396935379589999174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/2396935379589999174'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1228418705948#c2396935379589999174' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-8633327789606279540</id><published>2008-07-23T16:18:25.287-07:00</published><updated>2008-07-23T16:18:25.287-07:00</updated><title type='text'>Thanks a lot for this. Was searching around for ag...</title><content type='html'>Thanks a lot for this. Was searching around for ages and found yours to be the most concise method. Thanks</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/8633327789606279540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/8633327789606279540'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1216855105287#c8633327789606279540' title=''/><author><name>David</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-547958760640336876</id><published>2008-07-16T11:07:33.025-07:00</published><updated>2008-07-16T11:07:33.025-07:00</updated><title type='text'>As the last comment indicated, you need to handle ...</title><content type='html'>As the last comment indicated, you need to handle ContentElement's differently. If you hit a content element then you should get the logical parent.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/547958760640336876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/547958760640336876'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1216231653025#c547958760640336876' title=''/><author><name>Andrew Smith</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-8595736497805484853</id><published>2008-07-02T06:02:54.581-07:00</published><updated>2008-07-02T06:02:54.581-07:00</updated><title type='text'>This code fails if the OriginalSource is derived f...</title><content type='html'>This code fails if the OriginalSource is derived from FrameworkContentElemnt (e.g. anything in a FlowDocument, such as Document.Run). Unfortunately, VisualTreeHelper deals with Visual and FrameworkElement objects, but not FrameworkContentElement objects. 8-|</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/8595736497805484853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/8595736497805484853'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1215003774581#c8595736497805484853' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-1763962216723404345</id><published>2008-06-23T06:07:34.351-07:00</published><updated>2008-06-23T06:07:34.351-07:00</updated><title type='text'>Thanks for the info.  It worked great in my projec...</title><content type='html'>Thanks for the info.  It worked great in my project and helped me solve two issues I was having.  I really am starting to like WPF, but it is still taking a long time to figure it all out.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1763962216723404345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1763962216723404345'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1214226454351#c1763962216723404345' title=''/><author><name>Chester</name><uri>http://chesterscleanhouse.blogspot.com</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-1280231586035520312</id><published>2008-04-02T11:24:08.874-07:00</published><updated>2008-04-02T11:24:08.874-07:00</updated><title type='text'>Thanks much, you just saved me some time figuring ...</title><content type='html'>Thanks much, you just saved me some time figuring it out. Here is a VB version.&lt;BR/&gt; Dim clickedToDoItem As ToDoItemInfo&lt;BR/&gt;        Dim dep As DependencyObject = CType(e.OriginalSource, DependencyObject)&lt;BR/&gt;        Do While dep IsNot Nothing AndAlso Not TypeOf (dep) Is ListViewItem&lt;BR/&gt;            dep = VisualTreeHelper.GetParent(dep)&lt;BR/&gt;        Loop&lt;BR/&gt;        If dep Is Nothing Then&lt;BR/&gt;            Return&lt;BR/&gt;        Else&lt;BR/&gt;            clickedToDoItem = CType(Me.lvToDo.ItemContainerGenerator.ItemFromContainer(dep), ToDoItemInfo)&lt;BR/&gt;        End If&lt;BR/&gt;        MessageBox.Show(String.Format("You clicked item: date={0},description={1}", clickedToDoItem.Due, clickedToDoItem.Description))</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1280231586035520312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/1280231586035520312'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1207160648874#c1280231586035520312' title=''/><author><name>Andreas</name><uri>http://www.dotnetjunkies.com/WebLog/azenker/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-6987609794641747479</id><published>2008-02-27T06:32:00.625-08:00</published><updated>2008-02-27T06:32:00.625-08:00</updated><title type='text'>Try this and see how it works... System.Data.DataR...</title><content type='html'>Try this and see how it works...&lt;BR/&gt; System.Data.DataRowView value = (System.Data.DataRowView)ListViewEmployeeDetails.SelectedValue;&lt;BR/&gt;               MessageBox.Show(value.Row[0].ToString());</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/6987609794641747479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/6987609794641747479'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1204122720625#c6987609794641747479' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6127132400597215190.post-3730186343513225454</id><published>2008-01-31T04:59:14.885-08:00</published><updated>2008-01-31T04:59:14.885-08:00</updated><title type='text'>I saw how to get row or item, but how can I get co...</title><content type='html'>I saw how to get row or item, but how can I get column information from the mouse click position?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/3730186343513225454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6127132400597215190/658150003039419606/comments/default/3730186343513225454'/><link rel='alternate' type='text/html' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html?showComment=1201784354885#c3730186343513225454' title=''/><author><name>K.V</name><uri>http://www.blogger.com/profile/10029242018332057224</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.nostatic.org/2007/12/wpf-listview-getting-clicked-item.html' ref='tag:blogger.com,1999:blog-6127132400597215190.post-658150003039419606' source='http://www.blogger.com/feeds/6127132400597215190/posts/default/658150003039419606' type='text/html'/></entry></feed>