Style a TabControl using templates for the TabControl and TabItem elements. : TabControl « Windows Presentation Foundation « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Windows Presentation Foundation » TabControlScreenshots 
Style a TabControl using templates for the TabControl and TabItem elements.
Style a TabControl using templates for the TabControl and TabItem elements.
    
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="TabControlStyles.Page1">
    <Page.Resources>
        <Style x:Key="{x:Type TabControl}" TargetType="{x:Type TabControl}">
            <Setter Property="BorderThickness" Value="3"/>
            <Setter Property="BorderBrush" Value="Red"/>
            <Setter Property="Background" Value="LightBlue"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TabControl">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border BorderThickness="0,0,1,1" BorderBrush="#D0CEBF" Grid.Row="1">
                                <Border BorderThickness="{TemplateBinding BorderThickness}" 
                    BorderBrush="{TemplateBinding BorderBrush}">
                                    <Border Background="{TemplateBinding Background}">
                                        <ContentPresenter ContentSource="SelectedContent"/>
                                    </Border>
                                </Border>
                            </Border>
                            <TabPanel Grid.Row="0" IsItemsHost="true"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>


    <StackPanel Background="Ivory">
        <TextBlock FontSize="24">Styled Tab Control</TextBlock>
        <TabControl Width="250">
            <TabItem Header="One">
                <Ellipse Width="200" Height="200" Fill="#CABCAB"/>
            </TabItem>
        </TabControl>
    </StackPanel>


</Page>

   
    
    
    
  
Related examples in the same category
1.Frame background, TabControl background
2.TabControl and Frame source
3.Style TabItemStyle TabItem
4.TabItem HeaderTabItem Header
5.Tab page headersTab page headers
6.Put Different Objects to TabItemPut Different Objects to TabItem
7.Tab TestTab Test
8.Binds a TabControl to a collection of Employee objectsBinds a TabControl to a collection of Employee objects
9.Bind a TabControl to a data sourceBind a TabControl to a data source
10.Use a GroupBox control to create a container for a TabControl.Use a GroupBox control to create a container for a TabControl.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.