I'm currently learning WPF and data binding got me...Any help is appreciated.
So I have two UserControls, let's say 1 and 2, inside and are simply displayed side-by-side in MainWindow.xaml. And in UserControl2 I want to bind something to an element of UserControl1. Like the code below that's failed(Obiviously):
{Binding ElementName=FolderView, Path=SelectedValue, Mode=OneWay}
where FolderView is a TreeView
in UserControl1, and I want to get its property in UserControl2.
I'm still very new to the MVVM thing. I think a static ViewModel would have solved it (Rectify me if this is bad). But the SelectedValue
property of a TreeView
is readonly
and I don't know how to bind it to a ViewModel.