Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Tagged as

WPF: Customize your Application with Styles and Control Templates (Part 2 of 2)

, 5 Jun 2010
Part two of the two-part tutorial on how to customize your WPF application using Styles and Control Templates
BlackCrystal_Code.zip
BlackCrystal
bin
Debug
BlackCrystal.vshost.exe
BlackCrystal.vshost.exe.manifest
Release
BlackCrystal.vshost.exe
BlackCrystal.suo
BlackCrystal.vbproj.user
My Project
MyExtensions
Settings.settings
obj
x86
Debug
BlackCrystal_MarkupCompile.i.cache
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
My Project.Resources.Designer.vb.dll
Release
BlackCrystal_MarkupCompile.i.cache
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
My Project.Resources.Designer.vb.dll
BlackCrystal_Demo.zip
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Black Crystal Style" Height="672" Width="958" Background="{StaticResource LightBackground}">
    <Grid Background="{x:Null}">
        <Button Content="Focus" Height="41" HorizontalAlignment="Left" Margin="12,101,0,0" Name="Button1" VerticalAlignment="Top" Width="140" Foreground="White" />
        <Button Content="Disabled" Height="39" HorizontalAlignment="Left" Margin="12,148,0,0" Name="Button2" VerticalAlignment="Top" Width="140" Foreground="White" IsEnabled="False" />
        <TextBox Height="71" HorizontalAlignment="Left" Margin="165,85,0,0" Name="TextBox1" VerticalAlignment="Top" Width="175" Foreground="White" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" TextWrapping="Wrap" HorizontalScrollBarVisibility="Visible" />
        <TextBox Height="25" HorizontalAlignment="Left" Margin="165,162,0,0" Name="TextBox2" VerticalAlignment="Top" Width="175" Foreground="White" IsEnabled="False" Text="Disabled" VerticalScrollBarVisibility="Hidden" AcceptsReturn="True" HorizontalScrollBarVisibility="Hidden" />
        <Button Content="Normal" Foreground="White" Height="41" HorizontalAlignment="Left" Margin="12,54,0,0" Name="Button3" VerticalAlignment="Top" Width="140"></Button>
        <TextBox Foreground="White" Height="25" HorizontalAlignment="Left" Margin="165,54,0,0" Name="TextBox3" VerticalAlignment="Top" Width="175" VerticalScrollBarVisibility="Disabled" />
        <Label Content="Button" Height="28" HorizontalAlignment="Left" Margin="12,12,0,0" Name="Label1" VerticalAlignment="Top" HorizontalContentAlignment="Center" Foreground="White" FontWeight="bold" Width="140" />
        <Label Content="TextBox" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="165,12,0,0" Name="Label2" VerticalAlignment="Top" Width="175" />
        <ComboBox Height="25" HorizontalAlignment="Left" Margin="353,61,0,0" Name="ComboBox1" VerticalAlignment="Top" Width="181" IsEditable="True" />
        <Label Content="ComboBox" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="353,11,0,0" Name="Label3" VerticalAlignment="Top" Width="175" />
        <ComboBox Height="25" HorizontalAlignment="Left" Margin="353,107,0,0" Name="ComboBox2" VerticalAlignment="Top" Width="181" />
        <ComboBox Height="25" HorizontalAlignment="Left" Margin="353,153,0,0" Name="ComboBox3" VerticalAlignment="Top" Width="181" IsEnabled="False" Text="Disabled" />
        <DataGrid Name="grilla" AutoGenerateColumns="False" Margin="12,263,0,0" CanUserResizeColumns="True" ItemsSource="{Binding Path=tabla1}" GridLinesVisibility="None" HeadersVisibility="Column" Height="157" VerticalAlignment="Top" HorizontalAlignment="Left" Width="522">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Columna 1" Binding="{Binding Path=Columna1}" MinWidth="125"></DataGridTextColumn>
                <DataGridTextColumn Header="Columna 2" Binding="{Binding Path=Columna2}" MinWidth="125"></DataGridTextColumn>
                <DataGridTextColumn Header="Columna 3" Binding="{Binding Path=Columna3}" MinWidth="125"></DataGridTextColumn>
                <DataGridTextColumn Header="Columna 4" Binding="{Binding Path=Columna4}" MinWidth="125"></DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
        <Label Content="DATAGRID" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="12,229,0,0" Name="Label4" VerticalAlignment="Top" Width="522" />
        <TabControl Height="157" HorizontalAlignment="Left" Margin="12,460,0,0" Name="TabControl1" VerticalAlignment="Top" Width="522">
            <TabItem Header="Selected" Name="TabItem1">
                <Grid />
            </TabItem>
            <TabItem Header="Disabled" IsEnabled="False" />
            <TabItem Header="TabItem3" IsSelected="False" Selector.IsSelected="False" />
            <TabItem Header="TabItem4" />
        </TabControl>
        <Label Content="TABCONTROL &amp; TABITEM" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="12,426,0,0" Name="Label5" VerticalAlignment="Top" Width="546" />
        <ProgressBar HorizontalAlignment="Left" Margin="554,61,0,0" Name="ProgressBar1" Width="185" Height="25" VerticalAlignment="Top" Value="75" IsIndeterminate="False" Orientation="Horizontal" IsTabStop="False" />
        <ProgressBar Height="25" HorizontalAlignment="Left" Margin="554,107,0,0" Name="ProgressBar2" VerticalAlignment="Top" Width="185" IsIndeterminate="True" />
        <ProgressBar Height="25" HorizontalAlignment="Left" Margin="554,153,0,0" Name="ProgressBar3" VerticalAlignment="Top" Width="185" IsEnabled="False" />
        <Label Content="ProgressBar" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="554,12,0,0" Name="Label7" VerticalAlignment="Top" Width="185" />
        <Label Content="GROUPBOX" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Right" HorizontalContentAlignment="Center" Margin="0,229,12,0" Name="Label6" VerticalAlignment="Top" Width="370" />
        <GroupBox Header="GroupBox1" Height="354" HorizontalAlignment="Left" Margin="554,263,0,0" Name="GroupBox1" VerticalAlignment="Top" Width="365" IsEnabled="True">
            <Grid />
        </GroupBox>
        <ScrollBar Height="109" HorizontalAlignment="Left" Margin="895,54,0,0" Name="ScrollBar1" VerticalAlignment="Top" Width="18" />
        <ScrollBar Height="18" HorizontalAlignment="Left" Margin="774,169,0,0" Name="ScrollBar2" VerticalAlignment="Top" Width="139" Orientation="Horizontal" />
        <Label Content="ScrollBar" FontWeight="bold" Foreground="White" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Margin="758,12,0,0" Name="Label8" VerticalAlignment="Top" Width="161" />
    </Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

JOSUEYERAY
Software Developer Plain Concepts
Spain Spain
MCP - .NET Framework 2.0 Application Development Fundamentals
MCTS - .NET Framework 3.5 Windows Forms Application
MCTS - .NET Framework 3.5 Windows Presentation Foundation

| Advertise | Privacy | Mobile
Web04 | 2.8.140826.1 | Last Updated 5 Jun 2010
Article Copyright 2010 by JOSUEYERAY
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid