Populating with Tabs

There are several ways to populate a tab control with tab items and they are:

  • Declaratively in your XAML code – suitable for cases when the tab items structure is known during the implementation phase and does not change in time.

  • Programmatically from the code-behind – use when the tab structure can be changed during run time by the user or other application logic.

  • Using data binding again from the code-behind - use when the tab structure is described in data model.

Each one of the approaches described above is applicable for certain cases and that’s why you have to choose the one that best fits your requirements.

Bear in mind that the XAML file is the best place to declare your user interface; use the code-behind only when you cannot do that in XAML.

See Also

In this article