ObservableCollection<Cat> cats = new ObervableCollection<Cat>
{
new Cat{ Name = "Sylvester", Age=8 },
new Cat{ Name = "Whiskers", Age=2 },
new Cat{ Name = "Sasha", Age=14 }
};
How can I access these instances?
Consider these instances are created to add treeViewItems (by assigning the above collection as ItemSource). I want to create one tabItem for one treeViewItem while Double Clicked on TreeViewItem, and I want to assign/use the above instance for storing the data from TabItems.
Consider a WPF window, which has TreeView on the left side and TabControl (in which I am creating TabItems) on the right side. When I populate the TreeView, I do above operation of adding instances to ObservableCollection. Then I want the TabItems (In TabControl) to have the same instances which are used to populate the TreeView.
Edit: * Creating Tabitems is not a problem here. But assigning/using the same instance that I used for populating TreeView is the problem. I am not able to get the same instance.