WPF: How hard could it be to get a SelectedItemTemplate?
Posted by: Rick Strahls WebLog,
on 24 May 2007 |
View original
Here's a fun one to do in WPF. Say you have a ListBox or ListView that is databound and you want to get at the content of the data template used for binding of the items in the list. In my case I want to trigger an animation when the item is selected to indicate the change.
It's quite easy to get a selected item from a list box:
// *** Bound item - ie. an XmlNode/XmlElement
XmlElement item = this.lstPhotos.SelectedItem as XmlElement;
if (item == null)
return;
This assumes...