I have a treeview:
<TreeView>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=TucActivity}">
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding Path="DisplayedStartTime"></Binding>
<Binding Path="Name"></Binding>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Message}" />
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
bounded to Observable Collection object:
MainTreeView.ItemsSource = ((App)Application.Current).TucOC;
I want that every time the ((App)Application.Current).TucOC
is updated
the selected item (and also the focus) will be the one in the observable collection.
I would like to do it in one place since the ((App)Application.Current).TucOC
is
updated in multiple places in the code.
What's the best option to do it?