Reputation: 7805
I am adding TabItems to my TabControl through code:
TabItem tab = new TabItem();
tab.Tag = type;
tab.Name = name;
tabControl.Items.Add(tab);
As you can see, I am using the Tag
property to store an additional piece of meta information. However, I need to store some additional information for one reason or another. What would be the best way to do this?
Upvotes: 0
Views: 64
Reputation: 81233
You can store information in Tag as an object[]
or can create attached property to store distinct information in case required.
To store the information as object[ ]:
tab.Tag = new object[] {type, property1, property2};
and to retrieve it back:
var tagInformation = tab.Tag as object[];
string type = tagInformation[0].ToString();
Upvotes: 1