in my window i have tree view and a text block. tree view is bound to a view model. tree nodes are bound to another view model. the tree view model provides a list of top level tree nodes, and the view model for tree nodes provides the list of node children. there is no notion of the currently selected node in the tree in my view models.
in the text block i want to display the value of a known property of the view model of the currently selected tree node.
my question is how is this done the right MVVM way? i would prefer to do it in XAML. should i add the property to the tree view model for the currently selected node and then simply bind the text block to this property? if so, how would i communicate to the tree view model the fact that the tree view has changed its current node?
or can i do it differenly? i do not know how...
EDIT: let me rephrase the question: how to set the text inside the text block to the Name property of the view model corresponding to the selected item when the view model's IsSelected property becomes true?