Posted by: Zeeshan Amjad | August 17, 2009

Primitives Panels in WPF: TabPanel


In WPF all the layout are defined by inheriting the Panel class. There are two main categories of layout classes. One is main layout classes and other are primitive panel class. These types are defined in two different namespaces names System.Windows.Controls and System.Windows.Controls.Primitives. This relationship is defined in the following diagrams.

Panel_03

TabPanel is defined in Primitives namespace. This panel is internally used by the tab control. This panel also places the controls in multiple rows if there isn’t enough spaces available just like tab control.

Here is a simple XAML file to show the usage of TabPanel.

  1: <Window x:Class="xamlTabPanel.Window1"
  2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4:     Title="TabPanel" Height="300" Width="400">
  5:     
  6:     <TabPanel>
  7:         <Button>Maryland</Button>
  8:         <Button>Virginia</Button>
  9:         <Button>West Virginia</Button>
 10:         <Button>Pennsylvania</Button>
 11:         <Button>Delaware</Button>
 12:         <Button>New Jersey</Button>
 13:         <Button>New York</Button>
 14:     </TabPanel>
 15: </Window>
 16: 

Here is the output of this program.

TabPanel

Advertisements

Responses

  1. […] define in System.Windows.Controls.Primitives namespace. We have already saw the example of TabPanel here. Here is a class diagram of all classes inherited by Panel […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: