In the Code, public static observablecollection <tabitem> ou = new observablecollection <tabitem> ();
Public void addb2 (string header, frameworkelement Fe)
{
Tabitem T = new tabitem ();
T. header = header;
T. content = Fe;
T. isselected = true;
Ou. Add (t );
}
This is a set of various windows (canvas, gird, images, custom controls, and so on are different and arbitrary windows). They are all put in the set above.
Then how can we bind a tabcontrol in XAML to this set to achieve the effect?
You can select different header headers to correctly display the content of different windows in ou.
I did not find any information on the Internet. The help example code
Complete the following two steps:
1) Define Your tabcontrol:
<Tabcontrol itemssource = "{binding}" name = "test"/>
2) bind your tabcontrol and collection:
Test. itemssource = ou;
It will be displayed normally.
Original article: http://social.msdn.microsoft.com/Forums/zh-CN/wpfzhchs/thread/c654fcb7-2f0d-422a-9300-77a9c214630a