Bind tabcontrol of WPF to different window Sets

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.