Target Type Derivatives : Style « Windows Presentation Foundation « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Windows Presentation Foundation » StyleScreenshots 
Target Type Derivatives
Target Type Derivatives
      

<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <StackPanel.Resources>

        <Style TargetType="{x:Type Control}">
            <Setter Property="Control.FontSize" Value="24" />
            <Setter Property="Control.Foreground" Value="Blue" />
            <Setter Property="Control.HorizontalAlignment" Value="Center" />
            <Setter Property="Control.Margin" Value="24" />
        </Style>

        <Style TargetType="{x:Type Button}"
               BasedOn="{StaticResource {x:Type Control}}">
            <Setter Property="Control.Foreground" Value="Red" />
        </Style>

        <Style TargetType="{x:Type Label}"
               BasedOn="{StaticResource {x:Type Control}}">
            <Setter Property="Control.Foreground" Value="Green" />
        </Style>

        <Style TargetType="{x:Type TextBox}"
               BasedOn="{StaticResource {x:Type Control}}">
        </Style>
    </StackPanel.Resources>

    <Button>
        Button Control
    </Button>

    <Label>
        Label Control
    </Label>

    <TextBox>
        TextBox Control
    </TextBox>
</StackPanel>


  

   
    
    
    
    
    
  
Related examples in the same category
1.Property Trigger: mouse over and focusedProperty Trigger: mouse over and focused
2.Multi Data Trigger DemoMulti Data Trigger Demo
3.Button Based On Style with Target TypeButton Based On Style with Target Type
4.Button With Local StyleButton With Local Style
5.Graphics StylesGraphics Styles
6.Reuse Font With StylesReuse Font With Styles
7.Style InheritanceStyle Inheritance
8.Override Style PropertiesOverride Style Properties
9.Create Styles That Adapt to the Current OS ThemeCreate Styles That Adapt to the Current OS Theme
10.Set OverridesDefaultStyle to trueSet OverridesDefaultStyle to true
11.Inherit from a Common Base StyleInherit from a Common Base Style
12.Add any overriding property valuesAdd any overriding property values
13.Clear customized style with NullClear customized style with Null
14.Create a Named StyleCreate a Named Style
15.Applying a Consistent Margin with a StyleApplying a Consistent Margin with a Style
16.Style applied to a Button elementStyle applied to a Button element
17.Create a custom Style and use it for Button with Style element and Setter elementCreate a custom Style and use it for Button with Style element and Setter element
18.Style targeting a specific type of element(Button)Style targeting a specific type of element(Button)
19.Extending a Style using the BasedOn attributeExtending a Style using the BasedOn attribute
20.Use number substitutions for different culture settingsUse number substitutions for different culture settings
21.Implicit use of a StyleImplicit use of a Style
22.Create a Typed Style for ButtonCreate a Typed Style for Button
23.The dash style of a line is specified by the StrokeDashArray property that gets or sets a collection of double variablesThe dash style of a line is specified by the StrokeDashArray property that gets or sets a collection of double variables
24.Create a style for use as a FocusVisualStyle on a control.Create a style for use as a FocusVisualStyle on a control.
25.Style with Property Trigger.xamlStyle with Property Trigger.xaml
26.Set a Style ProgrammaticallySet a Style Programmatically
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.