Your end users can click a tab’s header at run time to select and view the tab’s content. In addition to end user interaction, you can programmatically select a tab to display its content or you can select a tab using XAML to display the contents of a tab when the application starts up.
The following example code demonstrates how to select a tab. The procedural code assumes you have at least two TabItemEx objects or TabItem objects in the Items collection.
In XAML:
<igWindows:XamTabControl Name="xamTabControl1"> <igWindows:TabItemEx Header="Tab 1"> <!-- TODO: Add panel here --> </igWindows:TabItemEx> <igWindows:TabItemEx Header="Tab 2" IsSelected="True"> <!-- TODO: Add panel here --> </igWindows:TabItemEx> </igWindows:XamTabControl>
In Visual Basic:
DirectCast(Me.xamTabControl1.Items(1), TabItem).IsSelected = True
In C#:
((TabItem)this.xamTabControl1.Items[1]).IsSelected = true;