I have a Window with two use controls. One encapsulates a TreeView control and another is marely a string representation of a selected TreeViewItems details.
TreeView controls is already self sufficient - it will populate itself with content items. Each TreeViewItem has a datacontext.
Here is what I need to happen:
- Whenever a user clicks an item, it generates a Selected routed event that is being caught at the root container of my window.
- I need the event handler, that handles Selected routed event to be able to get some data (a property value) from the selected TreeViewItem's data context.
- Based on this value, my event handler will create a DetailsView control and will populate it with data.
Is my approach correct, in respect to handling the Selected events? How can I get the property value from my selected items data context?
Thank you.