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

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Windows Presentation Foundation » TabControl 
24.63.4.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>
WPF Style A Tab Control Using Templates For The Tab Control And Tab Item Elements
24.63.TabControl
24.63.1.Frame background, TabControl backgroundFrame background, TabControl background
24.63.2.TabControl and Frame sourceTabControl and Frame source
24.63.3.Style TabItemStyle TabItem
24.63.4.Style a TabControl using templates for the TabControl and TabItem elements.Style a TabControl using templates for the TabControl and TabItem elements.
24.63.5.TabItem HeaderTabItem Header
24.63.6.Tab page headersTab page headers
24.63.7.Put Different Objects to TabItemPut Different Objects to TabItem
24.63.8.Tab TestTab Test
24.63.9.Binds a TabControl to a collection of Employee objectsBinds a TabControl to a collection of Employee objects
24.63.10.Bind a TabControl to a data sourceBind a TabControl to a data source
24.63.11.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.