I have a usercontrol which contains a TreeView control. I am using MVVM pattern. I want to reuse this user control in different windows, each time binding the usercontrol to a different datacontext.
<UserControl Name="UserControl1".......>
..............
<TreeView ItemSource={Binding ...}...>
<HierarchicalDataTemplate...........\>
</TreeView>
..............
</UserControl>
In window 1, I want to bind a List<ObjectA>
to the TreeView.
In Window 2, I want to bind a List<ObjectB>
to the TreeView.
Is it possible to write a generic ViewModel for this usercontrol, so that I can bind different Types of data to the TreeView?? In case my question is not understood, please do let me know.