Initial WPF content migrated (#17)

* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
This commit is contained in:
Andy De George
2020-09-04 09:46:28 -07:00
committed by GitHub
parent dba50d6bf1
commit da363692ff
8215 changed files with 508408 additions and 11 deletions
@@ -0,0 +1,62 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<AssemblyName>AnimatingWithStoryboards_markup</AssemblyName>
<TargetType>winexe</TargetType>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<ApplicationIcon>App.ico</ApplicationIcon>
<RootNamespace>Microsoft.Samples.Animation.AnimatingWithStoryboards</RootNamespace>
<ProjectGuid>{77076AC3-80DC-41F1-9C3C-700A2561709C}</ProjectGuid>
<OutputPath>bin\$(Configuration)\</OutputPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<ProductVersion>10.0.20821</ProductVersion>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Data" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="app.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="DataTriggerStoryboardExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SampleViewer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="StoryboardExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PropertyTriggerExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="StyleStoryboardExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ControlTemplateStoryboardExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="App.ico" />
</ItemGroup>
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,90 @@
<!-- <SnippetGraphicsMMControlTemplateStoryboardExample> -->
<!-- ControlStoryboardExample.xaml
Uses storyboards to animate properties with a ControlTemplate. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="Animate Properties with Storyboards">
<Page.Resources>
<ControlTemplate x:Key="MyControlTemplate"
TargetType="{x:Type ContentControl}">
<Border
Margin="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<Border Name="innerBorder" Padding="10">
<Border.Background>
<SolidColorBrush x:Name="innerBorderBackgroundBrush"
Color="White" />
</Border.Background>
<Grid Name="contentPanel">
<Grid.Background>
<SolidColorBrush x:Name="contentPanelBrush" Color="White" />
</Grid.Background>
<ContentPresenter
Margin="10"
Content="{TemplateBinding Content}"
TextBlock.Foreground="{TemplateBinding Foreground}" />
</Grid>
</Border>
</Border>
<ControlTemplate.Triggers>
<!-- Event Trigger Example -->
<EventTrigger RoutedEvent="Border.MouseEnter" SourceName="innerBorder">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="innerBorderBackgroundBrush"
Storyboard.TargetProperty="Color"
From="White" To="#CCCCFF"
Duration="0:0:3" AutoReverse="True" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<!-- Property Trigger Example -->
<Trigger Property="IsMouseOver" Value="True" SourceName="contentPanel">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="contentPanelBrush"
Storyboard.TargetProperty="Color"
To="Purple" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="contentPanelBrush"
Storyboard.TargetProperty="Color"
To="White" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Page.Resources>
<Border Background="White">
<StackPanel Margin="30" HorizontalAlignment="Left" MinWidth="500">
<ContentControl Template="{StaticResource MyControlTemplate}"
Content="Hello, World" />
</StackPanel>
</Border>
</Page>
<!-- </SnippetGraphicsMMControlTemplateStoryboardExample> -->
@@ -0,0 +1,108 @@
<!-- <SnippetGraphicsMMDataTriggerStoryboardWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="DataTriggerStoryboardExample">
<Page.Resources>
<XmlDataProvider x:Key="InventoryData" XPath="Inventory/Books">
<x:XData>
<Inventory xmlns="">
<Books>
<Book ISBN="0-7356-0562-9" Stock="in" Number="9">
<Title>XML in Action</Title>
<Summary>XML Web Technology</Summary>
</Book>
<Book ISBN="0-7356-1370-2" Stock="in" Number="8">
<Title>Programming Microsoft Windows With C#</Title>
<Summary>C# Programming using the .NET Framework</Summary>
</Book>
<Book ISBN="0-7356-1288-9" Stock="out" Number="7">
<Title>Inside C#</Title>
<Summary>C# Language Programming</Summary>
</Book>
<Book ISBN="0-7356-1377-X" Stock="in" Number="5">
<Title>Introducing Microsoft .NET</Title>
<Summary>Overview of .NET Technology</Summary>
</Book>
<Book ISBN="0-7356-1448-2" Stock="out" Number="4">
<Title>Microsoft C# Language Specifications</Title>
<Summary>The C# language definition</Summary>
</Book>
</Books>
<CDs>
<CD Stock="in" Number="3">
<Title>Classical Collection</Title>
<Summary>Classical Music</Summary>
</CD>
<CD Stock="out" Number="9">
<Title>Jazz Collection</Title>
<Summary>Jazz Music</Summary>
</CD>
</CDs>
</Inventory>
</x:XData>
</XmlDataProvider>
<Style x:Key="AnimatedListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Margin" Value="0,2,0,2" />
<Setter Property="Padding" Value="0,2,0,2" />
<Style.Triggers>
<DataTrigger
Binding="{Binding XPath=@Stock}"
Value="out">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
From="0.25" To="0.5" Duration="0:0:1"
RepeatBehavior="Forever"
AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard FillBehavior="Stop">
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Page.Resources>
<StackPanel>
<ListBox HorizontalAlignment="Center"
ItemContainerStyle="{StaticResource AnimatedListBoxItemStyle}"
Padding="2">
<ListBox.ItemsSource>
<Binding Source="{StaticResource InventoryData}"
XPath="*"/>
</ListBox.ItemsSource>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock FontSize="12" Margin="0,0,10,0">
<TextBlock.Text>
<Binding XPath="Title"/>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMDataTriggerStoryboardWholePage> -->
@@ -0,0 +1,46 @@
<!-- <SnippetPropertyTriggerExample> -->
<!-- PropertyTriggerExample.xaml
Shows how to use property triggers to start animations. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="Animate Properties with Storyboards">
<Page.Resources>
<Style x:Key="PropertyTriggerExampleButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Opacity" Value="0.25" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.25" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
<StackPanel Margin="20">
<Button Style="{StaticResource PropertyTriggerExampleButtonStyle}">
Move the mouse over me.
</Button>
</StackPanel>
</Page>
<!-- </SnippetPropertyTriggerExample> -->
@@ -0,0 +1,26 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Animation.AnimatingWithStoryboards.SampleViewer"
WindowTitle="Animate Properties with Storyboards">
<DockPanel>
<TabControl>
<TabItem Header="Event Trigger Storyboard Example">
<Frame Source="StoryboardExample.xaml" />
</TabItem>
<TabItem Header="Property Trigger Storyboard Example">
<Frame Source="PropertyTriggerExample.xaml" />
</TabItem>
<TabItem Header="Style Storyboard Example">
<Frame Source="StyleStoryboardExample.xaml" />
</TabItem>
<TabItem Header="ControlTemplate Storyboard Example">
<Frame Source="ControlTemplateStoryboardExample.xaml" />
</TabItem>
<TabItem Header="DataTrigger Storyboard Example">
<Frame Source="DataTriggerStoryboardExample.xaml" />
</TabItem>
</TabControl>
</DockPanel>
</Page>
@@ -0,0 +1,59 @@
<!-- <Snippet1> -->
<!-- StoryboardExample.xaml
Uses storyboards to animate properties. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="Animate Properties with Storyboards">
<Border Background="White">
<StackPanel Margin="30" HorizontalAlignment="Left" MinWidth="500">
<TextBlock>Storyboard Animation Example</TextBlock>
<!-- The width of this button is animated. -->
<Button Name="myWidthAnimatedButton"
Height="30" Width="200" HorizontalAlignment="Left">
A Button
<Button.Triggers>
<!-- Animates the width of the first button
from 200 to 300. -->
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="myWidthAnimatedButton"
Storyboard.TargetProperty="Width"
From="200" To="300" Duration="0:0:3" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<!-- The color of the brush used to paint this button is animated. -->
<Button Height="30" Width="200"
HorizontalAlignment="Left">Another Button
<Button.Background>
<SolidColorBrush x:Name="myAnimatedBrush" Color="Blue" />
</Button.Background>
<Button.Triggers>
<!-- Animates the color of the brush used to paint
the second button from red to blue . -->
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="myAnimatedBrush"
Storyboard.TargetProperty="Color"
From="Red" To="Blue" Duration="0:0:7" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Border>
</Page>
<!-- </Snippet1> -->
@@ -0,0 +1,82 @@
<!-- <SnippetGraphicsMMStyleStoryboardExample> -->
<!-- StyleStoryboardsExample.xaml
This example shows how to create storyboards in a style. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="Animate within a Style">
<Page.Resources>
<!-- Defines a Button style. -->
<Style TargetType="{x:Type Button}" x:Key="MyButtonStyle">
<Setter Property="Button.Background">
<Setter.Value>
<SolidColorBrush Color="Orange" />
</Setter.Value>
</Setter>
<Style.Triggers>
<!-- Animates the button's opacity on mouse over. -->
<EventTrigger RoutedEvent="Button.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="(Button.Opacity)"
From="1.0" To="0.5" Duration="0:0:0.5" AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<!-- Returns the button's opacity to 1 when the mouse leaves. -->
<EventTrigger RoutedEvent="Button.MouseLeave">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="(Button.Opacity)"
To="1" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<!-- Changes the button's color when clicked.
Notice that the animation can't target the
SolidColorBrush used to paint the button's background
directly. The brush must be accessed through the button's
Background property. -->
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)"
From="Orange" To="White" Duration="0:0:0.1" AutoReverse="True" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</Page.Resources>
<Border Background="White">
<StackPanel Margin="30" HorizontalAlignment="Left" MinWidth="500">
<Button
Style="{StaticResource MyButtonStyle}"
Content="Click Me" />
</StackPanel>
</Border>
</Page>
<!-- </SnippetGraphicsMMStyleStoryboardExample> -->
@@ -0,0 +1,45 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="SampleViewer.xaml">
<Application.Resources>
<Style TargetType="{x:Type Canvas}">
<Setter Property="Canvas.HorizontalAlignment" Value="Center" />
<Setter Property="Canvas.Background">
<Setter.Value>
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile"
AlignmentX="Left" AlignmentY="Top">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#99FFFFFF">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,1,1" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z" Brush="#99CCCCFF" />
<GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="#99CCCCFF" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Button}">
<Setter Property="Button.MinWidth" Value="120"/>
<Setter Property="Button.HorizontalAlignment" Value="Center" />
</Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="StackPanel.HorizontalAlignment" Value="Center" />
</Style>
</Application.Resources>
</Application>
@@ -0,0 +1,11 @@
<!--<SnippetSetApplicationMainWindowXAML>-->
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="StartupWindow.xaml"
>
<Application.MainWindow>
<NavigationWindow Source="MainPage.xaml" Visibility="Visible"></NavigationWindow>
</Application.MainWindow>
</Application>
<!--</SnippetSetApplicationMainWindowXAML>-->
@@ -0,0 +1,9 @@
<Page x:Class="CSharp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainPage"
>
<Grid>
</Grid>
</Page>
@@ -0,0 +1,24 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CSharp
{
/// <summary>
/// Interaction logic for MainPage.xaml
/// </summary>
public partial class MainPage : Page
{
public MainPage()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,52 @@
#region Using directives
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Resources;
using System.Globalization;
using System.Windows;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XAML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("XAML")]
[assembly: AssemblyCopyright("Copyright @ Microsoft 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace XAML.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XAML.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace XAML.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,9 @@
<Window x:Class="XAML.StartupWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Startup Window" Height="300" Width="300"
>
<Grid>
</Grid>
</Window>
@@ -0,0 +1,24 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace XAML
{
/// <summary>
/// Interaction logic for StartupWindow.XAML
/// </summary>
public partial class StartupWindow : Window
{
public StartupWindow()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,85 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{81575C54-3234-4369-B1B5-C3D0F4D98390}</ProjectGuid>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<RootNamespace>XAML</RootNamespace>
<AssemblyName>XAML</AssemblyName>
<WarningLevel>4</WarningLevel>
<OutputType>winexe</OutputType>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
<BootstrapperEnabled>false</BootstrapperEnabled>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<ProductVersion>10.0.20821</ProductVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
<Reference Include="ReachFramework" />
<Reference Include="System.Printing" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.IdentityModel" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml" />
<Page Include="MainPage.xaml" />
<Page Include="StartupWindow.xaml" />
<Compile Include="StartupWindow.xaml.cs">
<DependentUpon>StartupWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<AppDesigner Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,53 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- MSBUILD Project File -->
<PropertyGroup>
<AssemblyName>BlankSample</AssemblyName>
<DefaultClrNameSpace>Blank3DSample</DefaultClrNameSpace>
<TargetType>winexe</TargetType>
<Configuration>Debug</Configuration>
<BuildSystem>MSBuild</BuildSystem>
<HostInBrowser>False</HostInBrowser>
<ApplicationIcon>App.ico</ApplicationIcon>
<OutputPath>bin\$(Debug)\</OutputPath>
<ProductVersion>10.0.20821</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EE434869-7982-4ADE-B848-1C5500C94289}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<!--Import the target file that contains all the common targets -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<!-- Aplication Definition Markup File -->
<ApplicationDefinition Include="app.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<!-- Compiled Xaml Files -->
<Page Include="Window1.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<!-- Compiled Code Files -->
<!-- Compiled-in Resources -->
<Resource Include="App.ico" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Data" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
</ItemGroup>
</Project>
@@ -0,0 +1,87 @@
<!-- To show this window, do this: Window w=new Window1; w.Show(); -->
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Blank3DSample.Window1"
Title="Basic 3D Markup Sample">
<DockPanel>
<!-- Viewport3D is the rendering surface. -->
<Viewport3D Name="myViewport" >
<!-- Add models. -->
<ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup >
<Model3DGroup.Children>
<!-- Lights, MeshGeometry3D and DiffuseMaterial objects are added to
the Model3DGroup. -->
<!--<SnippetBasic3DXAML3DN2>-->
<DirectionalLight Color="#FFFFFFFF" Direction="-3,-4,-5" />
<!--</SnippetBasic3DXAML3DN2>-->
<!-- Define a plane. -->
<!--<SnippetBasic3DXAML3DN3>-->
<GeometryModel3D>
<!--<SnippetBasic3DXAML3DN4>-->
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="-1 -1 0 1 -1 0 -1 1 0 1 1 0"
Normals="0 0 1 0 0 1 0 0 1 0 0 1"
TextureCoordinates="0 1 1 1 0 0 1 0 "
TriangleIndices="0 1 2 1 3 2" />
</GeometryModel3D.Geometry>
<!--</SnippetBasic3DXAML3DN4>-->
<!--<SnippetBasic3DXAML3DN5>-->
<GeometryModel3D.Material>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<SolidColorBrush Color="Cyan" Opacity="0.3"/>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</GeometryModel3D.Material>
<!--</SnippetBasic3DXAML3DN5>-->
<!-- Translate the plane. -->
<!--<SnippetBasic3DXAML3DN6>-->
<GeometryModel3D.Transform>
<TranslateTransform3D
OffsetX="2" OffsetY="0" OffsetZ="-1" >
</TranslateTransform3D>
</GeometryModel3D.Transform>
<!--</SnippetBasic3DXAML3DN6>-->
</GeometryModel3D>
<!--</SnippetBasic3DXAML3DN3>-->
<!-- Define a cone. -->
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0.293893 -0.5 0.404509 0.475528 -0.5 0.154509 0 0.5 0 0.475528 -0.5 0.154509 0 0.5 0 0 0.5 0 0.475528 -0.5 0.154509 0.475528 -0.5 -0.154509 0 0.5 0 0.475528 -0.5 -0.154509 0 0.5 0 0 0.5 0 0.475528 -0.5 -0.154509 0.293893 -0.5 -0.404509 0 0.5 0 0.293893 -0.5 -0.404509 0 0.5 0 0 0.5 0 0.293893 -0.5 -0.404509 0 -0.5 -0.5 0 0.5 0 0 -0.5 -0.5 0 0.5 0 0 0.5 0 0 -0.5 -0.5 -0.293893 -0.5 -0.404509 0 0.5 0 -0.293893 -0.5 -0.404509 0 0.5 0 0 0.5 0 -0.293893 -0.5 -0.404509 -0.475528 -0.5 -0.154509 0 0.5 0 -0.475528 -0.5 -0.154509 0 0.5 0 0 0.5 0 -0.475528 -0.5 -0.154509 -0.475528 -0.5 0.154509 0 0.5 0 -0.475528 -0.5 0.154509 0 0.5 0 0 0.5 0 -0.475528 -0.5 0.154509 -0.293892 -0.5 0.404509 0 0.5 0 -0.293892 -0.5 0.404509 0 0.5 0 0 0.5 0 -0.293892 -0.5 0.404509 0 -0.5 0.5 0 0.5 0 0 -0.5 0.5 0 0.5 0 0 0.5 0 0 -0.5 0.5 0.293893 -0.5 0.404509 0 0.5 0 0.293893 -0.5 0.404509 0 0.5 0 0 0.5 0 "
Normals="0.7236065,0.4472139,0.5257313 0.2763934,0.4472138,0.8506507 0.5308242,0.4294462,0.7306172 0.2763934,0.4472138,0.8506507 0,0.4294458,0.9030925 0.5308242,0.4294462,0.7306172 0.2763934,0.4472138,0.8506507 -0.2763934,0.4472138,0.8506507 0,0.4294458,0.9030925 -0.2763934,0.4472138,0.8506507 -0.5308242,0.4294462,0.7306172 0,0.4294458,0.9030925 -0.2763934,0.4472138,0.8506507 -0.7236065,0.4472139,0.5257313 -0.5308242,0.4294462,0.7306172 -0.7236065,0.4472139,0.5257313 -0.858892,0.429446,0.279071 -0.5308242,0.4294462,0.7306172 -0.7236065,0.4472139,0.5257313 -0.8944269,0.4472139,0 -0.858892,0.429446,0.279071 -0.8944269,0.4472139,0 -0.858892,0.429446,-0.279071 -0.858892,0.429446,0.279071 -0.8944269,0.4472139,0 -0.7236065,0.4472139,-0.5257313 -0.858892,0.429446,-0.279071 -0.7236065,0.4472139,-0.5257313 -0.5308242,0.4294462,-0.7306172 -0.858892,0.429446,-0.279071 -0.7236065,0.4472139,-0.5257313 -0.2763934,0.4472138,-0.8506507 -0.5308242,0.4294462,-0.7306172 -0.2763934,0.4472138,-0.8506507 0,0.4294458,-0.9030925 -0.5308242,0.4294462,-0.7306172 -0.2763934,0.4472138,-0.8506507 0.2763934,0.4472138,-0.8506507 0,0.4294458,-0.9030925 0.2763934,0.4472138,-0.8506507 0.5308249,0.4294459,-0.7306169 0,0.4294458,-0.9030925 0.2763934,0.4472138,-0.8506507 0.7236068,0.4472141,-0.5257306 0.5308249,0.4294459,-0.7306169 0.7236068,0.4472141,-0.5257306 0.8588922,0.4294461,-0.27907 0.5308249,0.4294459,-0.7306169 0.7236068,0.4472141,-0.5257306 0.8944269,0.4472139,0 0.8588922,0.4294461,-0.27907 0.8944269,0.4472139,0 0.858892,0.429446,0.279071 0.8588922,0.4294461,-0.27907 0.8944269,0.4472139,0 0.7236065,0.4472139,0.5257313 0.858892,0.429446,0.279071 0.7236065,0.4472139,0.5257313 0.5308242,0.4294462,0.7306172 0.858892,0.429446,0.279071 " TriangleIndices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 " />
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<SolidColorBrush Color="Red" Opacity="1.0"/>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</GeometryModel3D.Material>
</GeometryModel3D>
</Model3DGroup.Children>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
<!--<SnippetBasic3DXAML3DN1>-->
<!-- Add a camera. -->
<Viewport3D.Camera>
<PerspectiveCamera FarPlaneDistance="20" LookDirection="5,-2,-3" UpDirection="0,1,0" NearPlaneDistance="1" Position="-5,2,3" FieldOfView="45" />
</Viewport3D.Camera>
<!--</SnippetBasic3DXAML3DN1>-->
</Viewport3D>
</DockPanel>
</Window>
@@ -0,0 +1,11 @@
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Blank3DSample.app"
StartupUri="Window1.xaml"
>
<!-- Resources & Styles defined in this section will impact the entire application. -->
<Application.Resources>
</Application.Resources>
</Application>
@@ -0,0 +1,30 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.AlignmentExample"
WindowTitle="Alignment Example"
Background="White">
<StackPanel>
<!-- <SnippetGraphicsMMTopLeftAlignmentExample> -->
<Rectangle
Width="150"
Height="150"
Stroke="LimeGreen"
StrokeThickness="1">
<Rectangle.Fill>
<ImageBrush
Stretch="None"
AlignmentX="Left"
AlignmentY="Top"
ImageSource="sampleImages\triangle.jpg"/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMTopLeftAlignmentExample> -->
</StackPanel>
</Page>
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,75 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<AssemblyName>BrushExamples</AssemblyName>
<TargetType>winexe</TargetType>
<Configuration>Release</Configuration>
<ApplicationIcon>App.ico</ApplicationIcon>
<ProductVersion>10.0.20821</ProductVersion>
<RootNamespace>Microsoft.Samples.BrushExamples</RootNamespace>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9D37563A-C550-4347-9EEF-942BF2330B79}</ProjectGuid>
<OutputPath>bin\$(Configuration)\</OutputPath>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.xml" />
<Reference Include="System.Data" />
<Reference Include="WindowsBase" />
<Reference Include="UIAutomationProvider" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationTypes" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="MyApp.xaml" />
<Page Include="SampleViewer.xaml" />
<Page Include="SolidColorBrushExample.xaml" />
<Page Include="OpacityExample.xaml" />
<Page Include="SolidColorBrushAnimationExample.xaml" />
<Page Include="ImageBrushExample.xaml" />
<Page Include="DrawingBrushExample.xaml" />
<Page Include="VisualBrushExample.xaml" />
<Page Include="StretchExample.xaml" />
<Page Include="StretchIllustration.xaml" />
<Page Include="AlignmentExample.xaml" />
<Page Include="TileIllustration.xaml" />
<Page Include="TilingExample.xaml" />
<Page Include="TileSizeExample.xaml" />
<Page Include="TileSizeIllustration.xaml" />
<Page Include="ViewboxIllustration.xaml" />
<Page Include="ViewboxIllustration2.xaml" />
<Page Include="ViewboxExample.xaml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SampleViewer.xaml.cs">
<DependentUpon>SampleViewer.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MyApp.xaml.cs">
<DependentUpon>MyApp.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="SolidColorBrushExample.xaml.cs">
<DependentUpon>SolidColorBrushExample.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="OpacityExample.xaml.cs">
<DependentUpon>OpacityExample.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="SolidColorBrushAnimationExample.xaml.cs">
<DependentUpon>SolidColorBrushAnimationExample.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Resource Include="App.ico" />
<Resource Include="sampleImages\*.*" />
</ItemGroup>
</Project>
@@ -0,0 +1,36 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.DrawingBrushExample"
WindowTitle="DrawingBrush Example"
Background="White">
<StackPanel>
<!-- <SnippetGraphicsMMDrawingBrushAsButtonBackgroundExample> -->
<Button Content="A Button">
<Button.Background>
<DrawingBrush>
<DrawingBrush.Drawing>
<GeometryDrawing Brush="LightBlue">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry RadiusX="12.5" RadiusY="25" Center="25,50" />
<EllipseGeometry RadiusX="12.5" RadiusY="25" Center="50,50" />
<EllipseGeometry RadiusX="12.5" RadiusY="25" Center="75,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Thickness="1" Brush="Gray" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Button.Background>
</Button>
<!-- </SnippetGraphicsMMDrawingBrushAsButtonBackgroundExample> -->
</StackPanel>
</Page>
@@ -0,0 +1,23 @@
<!-- <SnippetGraphicsMMImageBrushAsCanvasBackgroundExampleWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.ImageBrushExample"
WindowTitle="ImageBrush Example"
Background="White">
<StackPanel>
<!-- <SnippetGraphicsMMImageBrushAsCanvasBackgroundExample> -->
<Canvas
Height="200" Width="300">
<Canvas.Background>
<ImageBrush ImageSource="sampleImages\Waterlilies.jpg" />
</Canvas.Background>
</Canvas>
<!-- </SnippetGraphicsMMImageBrushAsCanvasBackgroundExample> -->
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMImageBrushAsCanvasBackgroundExampleWholePage> -->
@@ -0,0 +1,386 @@
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.MyApp"
Startup="myAppStartup">
<Application.Resources>
<DrawingGroup x:Key="TriangularTile">
<DrawingGroup>
<GeometryDrawing Geometry="M0,0 L50,0 0,50Z" Brush="#CCCCFF" />
</DrawingGroup>
<GeometryDrawing Geometry="M1,1 L49,1 1,49Z">
<GeometryDrawing.Pen>
<Pen Thickness="2" Brush="Black" MiterLimit="0" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
<DrawingGroup x:Key="TestPatternDrawing">
<DrawingGroup.Children>
<GeometryDrawing
Brush="LightGray">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0 100,100" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing
Brush="#22000000">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0 50,50" />
<RectangleGeometry Rect="50,50 50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing >
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0 100,100" />
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<RadialGradientBrush RadiusX="5" RadiusY="5"
Center="50,50" GradientOrigin="50,50"
MappingMode="Absolute"
SpreadMethod="Reflect">
<GradientStop Offset="0.0" Color="Gray" />
<GradientStop Offset="0.25" Color="Transparent" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing >
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0 100,100" />
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<DrawingBrush Viewport="0,0,0.1,0.1" TileMode="Tile">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="Gray">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0 1,50" />
<RectangleGeometry Rect="1,0 40,1" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing Geometry="M0,10 L10,0 100,90, 90,100z"
Brush="Black" />
<GeometryDrawing Geometry="M90,0 L100,10 10,100 0,90z"
Brush="Black" />
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,45 100,10" />
<RectangleGeometry Rect="45,0 10,100" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<RadialGradientBrush>
<GradientStop Offset="0.5" Color="White" />
<GradientStop Offset="1.0" Color="Transparent" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<GeometryGroup>
<RectangleGeometry Rect="0,45 100,10" />
<RectangleGeometry Rect="45,0 10,100" />
<GeometryGroup.Transform>
<RotateTransform Angle="22.5" CenterX="50" CenterY="50" />
</GeometryGroup.Transform>
</GeometryGroup>
<GeometryGroup>
<RectangleGeometry Rect="0,45 100,10" />
<RectangleGeometry Rect="45,0 10,100" />
<GeometryGroup.Transform>
<RotateTransform Angle="-22.5" CenterX="50" CenterY="50" />
</GeometryGroup.Transform>
</GeometryGroup>
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<RadialGradientBrush>
<GradientStop Offset="0.5" Color="Gray" />
<GradientStop Offset="1.0" Color="Transparent" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing
Brush="#99FFFFFF">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="25,25 50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<DrawingGroup>
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="0" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="90" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="180" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="270" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<RadialGradientBrush>
<GradientStop Offset="0.5" Color="#3333ff" />
<GradientStop Offset="1.0" Color="Transparent" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="0" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="90" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="180" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<PathGeometry Figures="M25,25 75,25, 50,10">
<PathGeometry.Transform>
<RotateTransform Angle="270" CenterX="50" CenterY="50" />
</PathGeometry.Transform>
</PathGeometry>
<GeometryGroup.Transform>
<RotateTransform Angle="45" CenterX="50" CenterY="50" />
</GeometryGroup.Transform>
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<RadialGradientBrush>
<GradientStop Offset="0.5" Color="#3333ff" />
<GradientStop Offset="1.0" Color="Transparent" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing
Brush="White">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="40,40 20,20" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
<GeometryDrawing
Brush="White">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry Center="10,10" RadiusX="5" RadiusY="5" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing
Brush="White">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry Center="90,10" RadiusX="5" RadiusY="5" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing
Brush="White">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry Center="10,90" RadiusX="5" RadiusY="5" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing
Brush="White">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry Center="90,90" RadiusX="5" RadiusY="5" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
<DrawingImage x:Key="GeometricImage">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0, 100,100">
</RectangleGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#CCCCFF">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="5,5, 90,90">
</RectangleGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,45, 100,10">
<RectangleGeometry.Transform>
<RotateTransform CenterX="50" CenterY="50" Angle="45" />
</RectangleGeometry.Transform>
</RectangleGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,45, 100,10">
<RectangleGeometry.Transform>
<RotateTransform CenterX="50" CenterY="50" Angle="-45" />
</RectangleGeometry.Transform>
</RectangleGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<DrawingGroup>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="25,25, 50,50">
<RectangleGeometry.Transform>
<RotateTransform CenterX="50" CenterY="50" Angle="45" />
</RectangleGeometry.Transform>
</RectangleGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<DrawingGroup.BitmapEffect>
<BevelBitmapEffect />
</DrawingGroup.BitmapEffect>
</DrawingGroup>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="10pt" />
<Setter Property="FontFamily" Value="Verdana" />
</Style>
<LinearGradientBrush x:Key="GrayBlueGradientBrush" StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="DarkGray" Offset="0" />
<GradientStop Color="#CCCCFF" Offset="0.5" />
<GradientStop Color="DarkGray" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="MyGlassBrushResource" StartPoint="0,0" EndPoint="1,1" Opacity="0.75">
<LinearGradientBrush.GradientStops>
<GradientStop Color="WhiteSmoke" Offset="0.2" />
<GradientStop Color="Transparent" Offset="0.4" />
<GradientStop Color="WhiteSmoke" Offset="0.5" />
<GradientStop Color="Transparent" Offset="0.75" />
<GradientStop Color="WhiteSmoke" Offset="0.9" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Application.Resources>
</Application>
@@ -0,0 +1,36 @@
using System;
using System.Windows;
using System.Data;
using System.Xml;
using System.Configuration;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
namespace Microsoft.Samples.BrushExamples
{
public partial class MyApp : Application
{
public MyApp()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
private void myAppStartup(object sender, StartupEventArgs args)
{
Window myWindow = new Window();
myWindow.Content = new SampleViewer();
myWindow.Show();
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs args)
{
MessageBox.Show("Unhandled exception: " + args.ExceptionObject.ToString());
}
}
}
@@ -0,0 +1,19 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.OpacityExample"
WindowTitle="Brush.Opacity Example"
Background="White">
<StackPanel>
<!-- <SnippetOpacityExample1XAML> -->
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetOpacityExample1XAML> -->
</StackPanel>
</Page>
@@ -0,0 +1,22 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media.Animation;
namespace Microsoft.Samples.BrushExamples
{
/// <summary>
/// Interaction logic for OpacityExample.xaml
/// </summary>
public partial class OpacityExample : Page
{
public OpacityExample()
{
}
}
}
@@ -0,0 +1,216 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="White" Margin="20">
<Page.Resources>
<BitmapImage x:Key="ExampleImage" UriSource="sampleImages\square.jpg" />
</Page.Resources>
<ScrollViewer>
<StackPanel Margin="20">
<Image Source="{StaticResource ExampleImage}" Width="100" Height="100" Stretch="Fill" />
<!-- Viewbox to Viewport -->
<StackPanel Orientation="Horizontal" Margin="30">
<Image Source="{StaticResource ExampleImage}" Width="100" Height="100" Stretch="Fill" />
<Image Source="{StaticResource ExampleImage}" Width="150" Height="150" Stretch="Uniform"
Margin="30,0,0,0" Opacity="0.25" />
<Grid Margin="30,0,0,0">
<Rectangle Width="200" Height="200">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="200" Height="100" Stroke="Black" StrokeThickness="1">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
</Rectangle>
</Grid>
</StackPanel>
<!-- Map -->
<StackPanel Orientation="Horizontal" Margin="30">
<Rectangle Width="200" Height="100" Stroke="Black" StrokeThickness="1" VerticalAlignment="Top">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
</Rectangle>
<Border BorderBrush="LimeGreen" Margin="30,0,0,0" VerticalAlignment="Top"
BorderThickness="1" HorizontalAlignment="Left"
Padding="0" Opacity="0.25">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.75" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
</Border>
<Border BorderBrush="LimeGreen" Margin="30,0,0,10" VerticalAlignment="Top"
BorderThickness="1" HorizontalAlignment="Left"
Padding="0">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
</Border>
</StackPanel>
<!-- Rotate -->
<StackPanel Orientation="Horizontal" Margin="30">
<Border BorderBrush="LimeGreen" Margin="0,0,0,10"
BorderThickness="1" HorizontalAlignment="Left"
Padding="0" VerticalAlignment="Center">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
</Border>
<Grid Margin="30,0,0,0" Width="150">
<Border BorderBrush="LimeGreen"
BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center"
Padding="0" RenderTransformOrigin="0.5,0.5" Opacity="0.25">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
<Border.RenderTransform>
<RotateTransform Angle="45" />
</Border.RenderTransform>
</Border>
</Grid>
<Border BorderBrush="LimeGreen" VerticalAlignment="Center"
BorderThickness="1" HorizontalAlignment="Left"
Padding="0" Margin="30,0,0,0">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" />
<RotateTransform Angle="90" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Border BorderBrush="LimeGreen" VerticalAlignment="Center"
BorderThickness="1" HorizontalAlignment="Left"
Padding="0" Margin="30,0,0,0">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" />
<RotateTransform Angle="90" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
</Border>
<Border BorderBrush="LimeGreen" VerticalAlignment="Center"
BorderThickness="1" HorizontalAlignment="Left"
Padding="0" Margin="30,0,0,0" Opacity="0.25"
RenderTransformOrigin="0.5,0.5">
<Rectangle Width="200" Height="100"
RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource ExampleImage}"
Stretch="UniformToFill" />
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" />
<RotateTransform Angle="90" />
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
<Border.LayoutTransform>
<ScaleTransform ScaleX="1.5" />
</Border.LayoutTransform>
</Border>
<Grid Margin="30,0,0,0">
<!-- <SnippetGraphicsMMRelativeTransformExample2Inline> -->
<Rectangle Width="200" Height="100" Stroke="Black" StrokeThickness="1">
<Rectangle.Fill>
<ImageBrush Stretch="UniformToFill">
<ImageBrush.ImageSource>
<BitmapImage UriSource="sampleImages\square.jpg" />
</ImageBrush.ImageSource>
<ImageBrush.RelativeTransform>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="90" />
</ImageBrush.RelativeTransform>
</ImageBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMRelativeTransformExample2Inline> -->
</Grid>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Page>
@@ -0,0 +1,77 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.SampleViewer"
WindowTitle="Brush Samples"
Background="White">
<DockPanel>
<TabControl>
<TabItem Header="SolidColorBrush Example">
<Frame Source="SolidColorBrushExample.xaml" />
</TabItem>
<TabItem Header="Opacity Example">
<Frame Source="OpacityExample.xaml" />
</TabItem>
<TabItem Header="SolidColorBrush Animation Example">
<Frame Source="SolidColorBrushAnimationExample.xaml" />
</TabItem>
<TabItem Header="ImageBrush Example">
<Frame Source="ImageBrushExample.xaml" />
</TabItem>
<TabItem Header="DrawingBrush Example">
<Frame Source="DrawingBrushExample.xaml" />
</TabItem>
<TabItem Header="VisualBrush Example">
<Frame Source="VisualBrushExample.xaml" />
</TabItem>
<TabItem Header="Stretch Example">
<Frame Source="StretchExample.xaml" />
</TabItem>
<TabItem Header="Stretch Illustration">
<Frame Source="StretchIllustration.xaml" />
</TabItem>
<TabItem Header="Alignment Example">
<Frame Source="AlignmentExample.xaml" />
</TabItem>
<TabItem Header="Tile Illustration">
<Frame Source="TileIllustration.xaml" />
</TabItem>
<TabItem Header="Tiling Example">
<Frame Source="TilingExample.xaml" />
</TabItem>
<TabItem Header="Tile Size Example">
<Frame Source="TileSizeExample.xaml" />
</TabItem>
<TabItem Header="Tile Size Illustration">
<Frame Source="TileSizeIllustration.xaml" />
</TabItem>
<TabItem Header="Viewbox Illustration">
<Frame Source="ViewboxIllustration.xaml" />
</TabItem>
<TabItem Header="Viewbox Illustration2">
<Frame Source="ViewboxIllustration2.xaml" />
</TabItem>
<TabItem Header="Viewbox Example" IsSelected="True">
<Frame Source="ViewboxExample.xaml" />
</TabItem>
</TabControl>
</DockPanel>
</Page>
@@ -0,0 +1,23 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media.Animation;
namespace Microsoft.Samples.BrushExamples
{
/// <summary>
/// Interaction logic for SampleViewer.xaml
/// </summary>
public partial class SampleViewer : Page
{
public SampleViewer()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,32 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.SolidColorBrushAnimationExample"
WindowTitle="SolidColorBrush Animation Example"
Background="White">
<StackPanel>
<Button>A Button
<Button.Background>
<SolidColorBrush x:Name="MyAnimatedSolidColorBrush" Color="Blue" />
</Button.Background>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="MyAnimatedSolidColorBrush"
Storyboard.TargetProperty="Color"
From="Red"
To="Blue"
Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Page>
@@ -0,0 +1,22 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media.Animation;
namespace Microsoft.Samples.BrushExamples
{
/// <summary>
/// Interaction logic for SampleViewer.xaml
/// </summary>
public partial class SolidColorBrushAnimationExample : Page
{
public SolidColorBrushAnimationExample()
{
}
}
}
@@ -0,0 +1,42 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.SolidColorBrushExample"
WindowTitle="SolidColorBrush Example"
Background="White">
<StackPanel>
<!-- <SnippetSolidColorBrushNamedColor1XAML> -->
<!-- This button's background is painted with a red SolidColorBrush,
described using a named color. -->
<Button Background="Red">A Button</Button>
<!-- </SnippetSolidColorBrushNamedColor1XAML> -->
<!-- <SnippetSolidColorBrushHex1XAML> -->
<!-- This button's background is painted with a red SolidColorBrush,
described using hexadecimal notation. -->
<Button Background="#FFFF0000">A Button</Button>
<!-- </SnippetSolidColorBrushHex1XAML> -->
<!-- <SnippetSolidColorBrushPropertyTag1XAML> -->
<!-- Both of these buttons' backgrounds are painted with red
SolidColorBrush objects, described using object element
syntax. -->
<Button>A Button
<Button.Background>
<SolidColorBrush Color="Red" />
</Button.Background>
</Button>
<Button>A Button
<Button.Background>
<SolidColorBrush Color="#FFFF0000" />
</Button.Background>
</Button>
<!-- </SnippetSolidColorBrushPropertyTag1XAML> -->
</StackPanel>
</Page>
@@ -0,0 +1,22 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media.Animation;
namespace Microsoft.Samples.BrushExamples
{
/// <summary>
/// Interaction logic for SampleViewer.xaml
/// </summary>
public partial class SolidColorBrushExample : Page
{
public SolidColorBrushExample()
{
}
}
}
@@ -0,0 +1,72 @@
<!-- <SnippetGraphicsMMStretchExampleWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.StretchExample"
WindowTitle="ImageBrush Example"
Background="White">
<StackPanel Orientation="Horizontal">
<!-- <SnippetGraphicsMMNoStretchExample> -->
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1"
Margin="0,0,5,0">
<Rectangle.Fill>
<ImageBrush
Stretch="None"
ImageSource="sampleImages\testImage.gif"/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMNoStretchExample> -->
<!-- <SnippetGraphicsMMUniformStretchExample> -->
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1"
Margin="0,0,5,0">
<Rectangle.Fill>
<ImageBrush
Stretch="Uniform"
ImageSource="sampleImages\testImage.gif"/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMUniformStretchExample> -->
<!-- <SnippetGraphicsMMUniformToFillStretchExample> -->
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1"
Margin="0,0,5,0">
<Rectangle.Fill>
<ImageBrush
Stretch="UniformToFill"
ImageSource="sampleImages\testImage.gif"/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMUniformToFillStretchExample> -->
<!-- <SnippetGraphicsMMFillStretchExample> -->
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1"
Margin="0,0,5,0">
<Rectangle.Fill>
<ImageBrush
Stretch="Fill"
ImageSource="sampleImages\testImage.gif"/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMFillStretchExample> -->
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMStretchExampleWholePage> -->
@@ -0,0 +1,62 @@
<!-- <SnippetGraphicsMMStretchIllustrationWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.StretchIllustration"
WindowTitle="Stretch Example"
Background="White">
<StackPanel Orientation="Horizontal">
<Image Stretch="None" Width="125" Height="175" Margin="0,0,5,0">
<Image.Source>
<DrawingImage Drawing="{StaticResource TestPatternDrawing}" />
</Image.Source>
</Image>
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1" Margin="0,0,5,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Stretch="None" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1" Margin="0,0,5,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Stretch="Uniform" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1" Margin="0,0,5,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Stretch="UniformToFill" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Width="125" Height="175"
Stroke="Black"
StrokeThickness="1" Margin="0,0,5,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Stretch="Fill" />
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMStretchIllustrationWholePage> -->
@@ -0,0 +1,143 @@
<!-- <SnippetTileBrushAlignmentExample> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Alignment Example"
Background="White" Margin="20">
<StackPanel>
<!-- <SnippetTileBrushTopLeftAlignmentInline> -->
<Rectangle
Width="150" Height="150"
Stroke="Red" StrokeThickness="2"
Margin="20">
<Rectangle.Fill>
<!-- This brush's content is aligned to the top-left
of its tile. -->
<DrawingBrush
Stretch="None"
AlignmentX="Left"
AlignmentY="Top">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="MediumBlue">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
<EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="Gray" Thickness="10" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetTileBrushTopLeftAlignmentInline> -->
<!-- <SnippetTileBrushBottomRightAlignmentInline> -->
<Rectangle
Width="150" Height="150"
Stroke="Red" StrokeThickness="2"
Margin="20">
<Rectangle.Fill>
<!-- This brush's content is aligned to the bottom right
of its tile. -->
<DrawingBrush
Stretch="None"
AlignmentX="Right"
AlignmentY="Bottom">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="MediumBlue">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
<EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="Gray" Thickness="10" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetTileBrushBottomRightAlignmentInline> -->
<!-- Tiled Alignment Examples
The next two examples show the effect of the AlignmentX
and AlignmentY properties on a tiled TileBrush. -->
<!-- <SnippetTileBrushTopLeftAlignmentTiledInline> -->
<Rectangle
Width="150" Height="150"
Stroke="Black" StrokeThickness="2"
Margin="20">
<Rectangle.Fill>
<!-- This brush's content is aligned to the top left
of its tile. -->
<DrawingBrush
Stretch="Uniform"
Viewport="0,0,0.25,0.5"
TileMode="Tile"
AlignmentX="Left"
AlignmentY="Top">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="MediumBlue">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
<EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="Gray" Thickness="10" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetTileBrushTopLeftAlignmentTiledInline> -->
<!-- <SnippetTileBrushBottomRightAlignmentTiledInline> -->
<Rectangle
Width="150" Height="150"
Stroke="Black" StrokeThickness="2"
Margin="20">
<Rectangle.Fill>
<!-- This brush's content is aligned to the top left
of its tile. -->
<DrawingBrush
Stretch="Uniform"
Viewport="0,0,0.25,0.5"
TileMode="Tile"
AlignmentX="Left"
AlignmentY="Bottom">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="MediumBlue">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
<EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="Gray" Thickness="10" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetTileBrushBottomRightAlignmentTiledInline> -->
</StackPanel>
</Page>
<!-- </SnippetTileBrushAlignmentExample> -->
@@ -0,0 +1,91 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="PresentationOptions"
Title="Alignment Example"
Background="White" Margin="20">
<Page.Resources>
<!-- This drawing is used by the DrawingBrush objects in this
example. -->
<GeometryDrawing Brush="MediumBlue" x:Key="ExampleDrawing"
PresentationOptions:Freeze="True" >
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
<EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="Gray" Thickness="10" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</Page.Resources>
<StackPanel>
<Rectangle Margin="20"
Width="150" Height="150"
Stroke="Red" StrokeThickness="2"
HorizontalAlignment="Left">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource ExampleDrawing}"
Stretch="None"
AlignmentX="Left"
AlignmentY="Top" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Width="150" Height="150"
Stroke="Red" StrokeThickness="2"
Margin="20" HorizontalAlignment="Left">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource ExampleDrawing}"
Stretch="None"
AlignmentX="Right"
AlignmentY="Bottom" />
</Rectangle.Fill>
</Rectangle>
<Grid>
<Rectangle HorizontalAlignment="Left"
Width="150" Height="150"
Stroke="Black" StrokeThickness="2"
Margin="20">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource ExampleDrawing}"
Stretch="Uniform"
Viewport="0,0,0.25,0.5"
TileMode="Tile"
AlignmentX="Left"
AlignmentY="Top" />
</Rectangle.Fill>
</Rectangle>
<Rectangle HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="20" Width="37.5" Height="75" Stroke="Red" StrokeThickness="2" />
</Grid>
<Grid>
<Rectangle HorizontalAlignment="Left"
Width="150" Height="150"
Stroke="Black" StrokeThickness="2"
Margin="20">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource ExampleDrawing}"
Stretch="Uniform"
Viewport="0,0,0.25,0.5"
TileMode="Tile"
AlignmentX="Left"
AlignmentY="Bottom" />
</Rectangle.Fill>
</Rectangle>
<Rectangle HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="20" Width="37.5" Height="75" Stroke="Red" StrokeThickness="2" />
</Grid>
</StackPanel>
</Page>
@@ -0,0 +1,90 @@
<!-- <SnippetGraphicsMMTileIllustrationWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.TileIllustration"
WindowTitle="Stretch Example"
Background="White" >
<StackPanel Orientation="Horizontal" Margin="20">
<Rectangle
Width="100" Height="100"
Stroke="#CCCCFF"
StrokeThickness="1" Margin="0,0,10,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TriangularTile}"
Viewport="0,0,0.25,0.25" />
</Rectangle.Fill>
<Rectangle.BitmapEffect>
<DropShadowBitmapEffect Color="Black" ShadowDepth="10"
Softness="1" Opacity="0.5" />
</Rectangle.BitmapEffect>
</Rectangle>
<Rectangle
Width="100" Height="100"
Stroke="#CCCCFF"
StrokeThickness="1" Margin="0,0,10,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TriangularTile}"
Viewport="0,0,0.25,0.25"
TileMode="Tile" />
</Rectangle.Fill>
<Rectangle.BitmapEffect>
<DropShadowBitmapEffect Color="Black" ShadowDepth="10"
Softness="1" Opacity="0.5" />
</Rectangle.BitmapEffect>
</Rectangle>
<Rectangle
Width="100" Height="100"
Stroke="#CCCCFF"
StrokeThickness="1" Margin="0,0,10,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TriangularTile}"
Viewport="0,0,0.25,0.25"
TileMode="FlipX" />
</Rectangle.Fill>
<Rectangle.BitmapEffect>
<DropShadowBitmapEffect Color="Black" ShadowDepth="10"
Softness="1" Opacity="0.5" />
</Rectangle.BitmapEffect>
</Rectangle>
<Rectangle
Width="100" Height="100"
Stroke="#CCCCFF"
StrokeThickness="1" Margin="0,0,10,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TriangularTile}"
Viewport="0,0,0.25,0.25"
TileMode="FlipY" />
</Rectangle.Fill>
<Rectangle.BitmapEffect>
<DropShadowBitmapEffect Color="Black" ShadowDepth="10"
Softness="1" Opacity="0.5" />
</Rectangle.BitmapEffect>
</Rectangle>
<Rectangle
Width="100" Height="100"
Stroke="#CCCCFF"
StrokeThickness="1" Margin="0,0,10,0">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TriangularTile}"
Viewport="0,0,0.25,0.25"
TileMode="FlipXY" />
</Rectangle.Fill>
<Rectangle.BitmapEffect>
<DropShadowBitmapEffect Color="Black" ShadowDepth="10"
Softness="1" Opacity="0.5" />
</Rectangle.BitmapEffect>
</Rectangle>
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMTileIllustrationWholePage> -->
@@ -0,0 +1,115 @@
<!-- <SnippetGraphicsMMTileSizeExampleWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.TileSizeExample"
WindowTitle="Tiling Example"
Background="White" >
<StackPanel Orientation="Vertical" Margin="20">
<StackPanel Orientation="Horizontal">
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<!-- <SnippetGraphicsMMRelativeViewportUnitsExample1> -->
<Rectangle
Width="50" Height="100">
<Rectangle.Fill>
<!-- Paints an area with 4 tiles. -->
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMRelativeViewportUnitsExample1> -->
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="200">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<!-- <SnippetGraphicsMMAbsoluteViewportUnitsExample1> -->
<Rectangle
Width="50" Height="100">
<Rectangle.Fill>
<!-- Paints an area with 25 x 25 tiles. -->
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,25,25"
ViewportUnits="Absolute"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMAbsoluteViewportUnitsExample1> -->
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,25,25"
ViewportUnits="Absolute"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="200">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,25,25"
ViewportUnits="Absolute"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMTileSizeExampleWholePage> -->
@@ -0,0 +1,126 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.TileSizeIllustration"
WindowTitle="Tiling Example"
Background="White" >
<StackPanel Orientation="Vertical" Margin="20">
<Rectangle
Height="200" Width="200"
Stroke="Black" StrokeThickness="2"
>
<Rectangle.Fill>
<DrawingBrush Viewbox="25,25,25,25" ViewboxUnits="Absolute"
Viewport="0,0,0.5,0.5" TileMode="Tile" Stretch="Fill"
Drawing="{StaticResource TestPatternDrawing}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Height="200" Width="200"
Stroke="Black" StrokeThickness="2"
>
<Rectangle.Fill>
<ImageBrush Viewbox="25,25,25,25" ViewboxUnits="Absolute"
Viewport="0,0,0.5,0.5" TileMode="Tile" Stretch="Fill"
ImageSource="sampleImages\cherries_larger.jpg" />
</Rectangle.Fill>
</Rectangle>
<TextBlock Margin="0,10,0,0" Foreground="White">Relative Viewport Units: <Bold>0,0,0.25,0.25</Bold></TextBlock>
<StackPanel Orientation="Horizontal">
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="50" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,0.5,0.5"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,0.5,0.5"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="200">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,0.5,0.5"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
<TextBlock Margin="0,10,0,0" Foreground="White">Absolute Viewport Units: <Bold>0,0,25,25</Bold></TextBlock>
<StackPanel Orientation="Horizontal">
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="50" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,25,25"
ViewportUnits="Absolute"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,25,25"
ViewportUnits="Absolute"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1"
Margin="0,0,10,0" VerticalAlignment="Top">
<Rectangle
Width="200" Height="200">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\cherries_larger.jpg"
Viewport="0,0,25,25"
ViewportUnits="Absolute"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
</StackPanel>
</Page>
@@ -0,0 +1,78 @@
<!-- <SnippetGraphicsMMTilingExampleWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.TilingExample"
WindowTitle="Tiling Example"
Background="White" >
<StackPanel Orientation="Horizontal" Margin="20">
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\triangle.jpg"
Viewport="0,0,0.25,0.25" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\triangle.jpg"
Viewport="0,0,0.25,0.25"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\triangle.jpg"
Viewport="0,0,0.25,0.25"
TileMode="FlipX" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\triangle.jpg"
Viewport="0,0,0.25,0.25"
TileMode="FlipY" />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<!-- <SnippetGraphicsMMFlipXYExample> -->
<Rectangle
Width="100" Height="100" >
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\triangle.jpg"
Viewport="0,0,0.25,0.25"
TileMode="FlipXY"
/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMFlipXYExample> -->
</Border>
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMTilingExampleWholePage> -->
@@ -0,0 +1,402 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.ViewboxExample"
WindowTitle="Tiling Example"
Background="White" >
<Page.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="8pt" />
<Setter Property="FontFamily" Value="Verdana" />
</Style>
<Style TargetType="{x:Type Border}">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
</Page.Resources>
<StackPanel Orientation="Vertical" Margin="20">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif" />
</Rectangle.Fill>
</Rectangle>
<StackPanel Margin="20">
<TextBlock>
Viewbox: 0,0, 0.25,0.5
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,10,0,20">
<StackPanel>
<Canvas Width="100" Height="100" VerticalAlignment="Top">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Stroke="Red" StrokeThickness="1"
Width="25" Height="50"
/>
</Canvas>
<TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
</StackPanel>
<Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">
</Path>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="None"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Fill"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Uniform"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="UniformToFill"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="20">
<TextBlock>
Viewbox: 0.5,0.25, 0.25,0.5
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,10,0,20">
<StackPanel>
<Canvas Width="100" Height="100" VerticalAlignment="Top">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Canvas.Left="50" Canvas.Top="25"
Stroke="Red" StrokeThickness="1"
Width="25" Height="50"
/>
</Canvas>
<TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
</StackPanel>
<Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">
</Path>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="None"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Fill"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Uniform"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="UniformToFill"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="20">
<TextBlock>
Viewbox: 0.5,0.25, 0.25,0.5
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,10,0,20">
<StackPanel>
<Canvas Width="100" Height="100" VerticalAlignment="Top">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Canvas.Left="50" Canvas.Top="25"
Stroke="Red" StrokeThickness="1"
Width="25" Height="50"
/>
</Canvas>
<TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
</StackPanel>
<Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">
</Path>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="None"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<!-- <SnippetGraphicsMMTileBrushViewboxWithStretchTiling> -->
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="Fill"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMTileBrushViewboxWithStretchTiling> -->
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="Uniform"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<ImageBrush
ImageSource="sampleImages\testImage.gif"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="UniformToFill"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</Page>
@@ -0,0 +1,380 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.ViewboxIllustration"
WindowTitle="Tiling Example"
Background="White" >
<Page.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="8pt" />
<Setter Property="FontFamily" Value="Verdana" />
</Style>
<Style TargetType="{x:Type Border}">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
</Page.Resources>
<StackPanel Orientation="Vertical" Margin="20">
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,20"
VerticalAlignment="Top" HorizontalAlignment="Left">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}" />
</Rectangle.Fill>
</Rectangle>
</Border>
<StackPanel Orientation="Vertical">
<Border BorderThickness="0" BorderBrush="Red"
Padding="0" Margin="0,20,0,0" >
<StackPanel >
<Border
BorderBrush="Red"
BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
<!--
<Border.Background>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5" >
<GradientStop Offset="0" Color="WhiteSmoke" />
<GradientStop Offset="1" Color="Transparent" />
</LinearGradientBrush>
</Border.Background>
-->
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0">Viewbox:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1">Viewport:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" Margin="10,0,0,0">0,0,1,1</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="0"
Margin="10,0,0,0">ViewboxUnits:</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="0"
Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="1"
Margin="10,0,0,0">ViewportUnits:</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="1"
Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
</Grid>
<!--
<Border.BitmapEffect>
<DropShadowBitmapEffect />
</Border.BitmapEffect>
-->
</Border>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">
<StackPanel Margin="0,0,10,0">
<Border BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Stretch="None"
/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock>Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="0,0,10,0">
<Border BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5" Stretch="Fill" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock>Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="0,0,10,0">
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="Uniform" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock>Stretch: Uniform</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
<Border BorderThickness="0" BorderBrush="Red"
Padding="0" Margin="0,20,0,0" >
<StackPanel >
<Border
BorderBrush="Red"
BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0">Viewbox:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1">Viewport:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="0"
Margin="10,0,0,0">ViewboxUnits:</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="0"
Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="1"
Margin="10,0,0,0">ViewportUnits:</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="1"
Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
</Grid>
</Border>
<StackPanel Orientation="Horizontal" Margin="0,5, 0, 0" HorizontalAlignment="Left">
<StackPanel Margin="0,0,10,0">
<TextBlock>Stretch: None</TextBlock>
<Border BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="None" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
<StackPanel Margin="0,0,10,0">
<TextBlock>Stretch: Fill</TextBlock>
<Border BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="Fill" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
<StackPanel Margin="0,0,10,0">
<TextBlock>Stretch: Uniform</TextBlock>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="Uniform" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
<StackPanel Margin="0">
<Border BorderThickness="0" BorderBrush="Red"
Padding="0" Margin="0, 20,0, 0" >
<StackPanel >
<Border
BorderBrush="Red"
BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0">Viewbox:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">0,0,0.25,0.5</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1">Viewport:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="2">TileMode:</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="2" Margin="10,0,0,0">Tile</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="0"
Margin="10,0,0,0">ViewboxUnits:</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="0"
Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="1"
Margin="10,0,0,0">ViewportUnits:</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="1"
Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
</Grid>
</Border>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">
<StackPanel Margin="0,0,10,0">
<TextBlock>Stretch: None</TextBlock>
<Border BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="None"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
<StackPanel Margin="0,0,10,0">
<TextBlock>Stretch: Fill</TextBlock>
<Border BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="Fill"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
<StackPanel Margin="0,0,10,0">
<TextBlock>Stretch: Uniform</TextBlock>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
Viewport="0,0,0.5,0.5"
Stretch="Uniform"
TileMode="Tile" />
</Rectangle.Fill>
</Rectangle>
</Border>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</StackPanel>
</Page>
@@ -0,0 +1,399 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.ViewboxIllustration2"
WindowTitle="Tiling Example"
Background="White" >
<Page.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="8pt" />
<Setter Property="FontFamily" Value="Verdana" />
</Style>
<Style TargetType="{x:Type Border}">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
</Page.Resources>
<StackPanel Orientation="Vertical" Margin="20">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}" />
</Rectangle.Fill>
</Rectangle>
<StackPanel Margin="20">
<TextBlock>
Viewbox: 0,0, 0.25,0.5
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,10,0,20">
<StackPanel>
<Canvas Width="100" Height="100" VerticalAlignment="Top">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Stroke="Red" StrokeThickness="1"
Width="25" Height="50"
/>
</Canvas>
<TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
</StackPanel>
<Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">
</Path>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="None"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Fill"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Uniform"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0,0,0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="UniformToFill"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="20">
<TextBlock>
Viewbox: 0.5,0.25, 0.25,0.5
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,10,0,20">
<StackPanel>
<Canvas Width="100" Height="100" VerticalAlignment="Top">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Canvas.Left="50" Canvas.Top="25"
Stroke="Red" StrokeThickness="1"
Width="25" Height="50"
/>
</Canvas>
<TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
</StackPanel>
<Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">
</Path>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="None"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Fill"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="Uniform"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,1,1"
ViewportUnits="RelativeToBoundingBox"
Stretch="UniformToFill"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="20">
<TextBlock>
Viewbox: 0.5,0.25, 0.25,0.5
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="0,10,0,20">
<StackPanel>
<Canvas Width="100" Height="100" VerticalAlignment="Top">
<Rectangle Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle
Canvas.Left="50" Canvas.Top="25"
Stroke="Red" StrokeThickness="1"
Width="25" Height="50"
/>
</Canvas>
<TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
</StackPanel>
<Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">
</Path>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="None"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="Fill"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="Uniform"
AlignmentX="Center"
AlignmentY="Center"/>
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
</StackPanel>
<StackPanel Margin="20,0,0,0" >
<Border
BorderBrush="Black" BorderThickness="1"
VerticalAlignment="Top">
<Rectangle
Width="100" Height="100">
<Rectangle.Fill>
<DrawingBrush
Drawing="{StaticResource TestPatternDrawing}"
Viewbox="0.5,0.25, 0.25,0.5"
ViewboxUnits="RelativeToBoundingBox"
Viewport="0,0,0.5,0.5"
ViewportUnits="RelativeToBoundingBox"
TileMode="Tile"
Stretch="UniformToFill"
AlignmentX="Center"
AlignmentY="Center" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</Page>
@@ -0,0 +1,29 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.BrushExamples.VisualBrushExample"
WindowTitle="VisualBrush Example"
Background="White">
<StackPanel>
<!-- <SnippetGraphicsMMVisualBrushAsRectangleBackgroundExample> -->
<Rectangle Width="150" Height="150" Stroke="Black" Margin="5,0,5,0">
<Rectangle.Fill>
<VisualBrush>
<VisualBrush.Visual>
<StackPanel Background="White">
<Rectangle Width="25" Height="25" Fill="Red" Margin="2" />
<TextBlock FontSize="10pt" Margin="2">Hello, World!</TextBlock>
<Button Margin="2">A Button</Button>
</StackPanel>
</VisualBrush.Visual>
</VisualBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMVisualBrushAsRectangleBackgroundExample> -->
</StackPanel>
</Page>
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

@@ -0,0 +1,142 @@
<!-- AnimatingSolidColorBrushExample.xaml
This example shows some of the different ways you can animate a SolidColorBrush. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowTitle="Animating a SolidColorBrush">
<DockPanel>
<Border Background="#996666CC"
Margin="10" DockPanel.Dock="Top">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
The SolidColorBrush objects used to paint these rectangles
have been animated in different ways. The first SolidColorBrush has an
animated Color property. The second has an animated Opacity property.
The Color property of the third SolidColorBrush is animated with a single
ColorAnimation so that its red, green, blue, and alpha values change.
</TextBlock>
</Border>
<Rectangle
Style="{StaticResource footerRectangleStyle}"
DockPanel.Dock="Bottom" Fill="#996666CC"
VerticalAlignment="Bottom" Margin="10" />
<Grid Margin="10" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Creates a checkered background for the animation examples. -->
<Rectangle Style="{StaticResource checkeredRectangleStyle}"
Stroke="#9999FF" RadiusX="10" RadiusY="10" Grid.Row="1"
Grid.Column="0" Grid.ColumnSpan="5" Grid.RowSpan="1" />
<Label Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center">Animated Color Property</Label>
<!-- The Color property of the SolidColorBrush used to fill this rectangle is animated. -->
<Rectangle
Width="100" Height="50" Stroke="Black" StrokeThickness="1"
Margin="10" HorizontalAlignment="Center"
Grid.Column="0" Grid.Row="1">
<Rectangle.Fill>
<SolidColorBrush x:Name="solidColorBrush1" Color="Blue" />
</Rectangle.Fill>
</Rectangle>
<Button Grid.Column="0" Grid.Row="2"
HorizontalAlignment="Center">
Start Animation
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- Animates the color of a SolidColorBrush from blue to red over 10 seconds. -->
<ColorAnimation Storyboard.TargetName="solidColorBrush1"
Storyboard.TargetProperty="Color"
From="Blue" To="Red" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Label Grid.Column="2" Grid.Row="0" HorizontalAlignment="Center">Animated Opacity Property</Label>
<!-- The Opacity property of this rectangle's SolidColorBrush is animated. -->
<Rectangle
Width="100" Height="50" Stroke="Black" StrokeThickness="1"
Grid.Column="2" Grid.Row="1"
HorizontalAlignment="Center" Margin="10">
<Rectangle.Fill>
<SolidColorBrush x:Name="solidColorBrush2" Color="Blue" />
</Rectangle.Fill>
</Rectangle>
<Button Grid.Column="2" Grid.Row="2"
HorizontalAlignment="Center">
Start Animation
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- Animates the opacity of a SolidColorBrush from 1 to 0 over 10 seconds. -->
<DoubleAnimation Storyboard.TargetName="solidColorBrush2"
Storyboard.TargetProperty="Opacity"
From="1.0" To="0.0" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Label Grid.Column="4" Grid.Row="0" HorizontalAlignment="Center">Animated Color Property</Label>
<!-- The Color property of this rectangle's SolidColorBrush is animated. -->
<Rectangle
Width="100" Height="50" Stroke="Black" StrokeThickness="1"
Grid.Column="4" Grid.Row="1"
HorizontalAlignment="Center" Margin="10">
<Rectangle.Fill>
<SolidColorBrush x:Name="solidColorBrush3" Color="Blue" />
</Rectangle.Fill>
</Rectangle>
<Button Grid.Column="4" Grid.Row="2"
HorizontalAlignment="Center">
Start Animation
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<!-- Animates both the opacity and color of a SolidColorBrush's color by specifying the destination color's
alpha values. The resulting animation transitions from fully-opaque blue to completely transparent
red over a duration of 10 seconds. -->
<ColorAnimation Storyboard.TargetName="solidColorBrush3"
Storyboard.TargetProperty="Color"
From="Blue" To="#00FF0000" Duration="0:0:10" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</Grid>
</DockPanel>
</Page>
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@@ -0,0 +1,261 @@
<!-- BrushOpacityExample.xaml
Demonstrates the Brush.Opacity property. -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="PresentationOptions"
Title="Brush Opacity">
<Page.Resources>
<!-- Because this GradientStopCollection and DrawingGroup
are used multiple times in this example,
they are defined here as resources and frozen to
improve performance. -->
<GradientStopCollection x:Key="myGradientStops"
PresentationOptions:Freeze="True">
<GradientStop Color="Blue" Offset="0.0" />
<GradientStop Color="Black" Offset="0.5" />
<GradientStop Color="Transparent" Offset="1.0" />
</GradientStopCollection>
<DrawingGroup x:Key="myDrawing" PresentationOptions:Freeze="True">
<DrawingGroup.Children>
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<LineGeometry StartPoint="0,0" EndPoint="1,1" />
<LineGeometry StartPoint="0,1" EndPoint="1,0" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Thickness="0.2" Brush="#3366FF" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Brush="Red"
Geometry="M 0.4,0.4 L 0.5,0.2 0.6,0.4 0.5,0.5" />
<GeometryDrawing Brush="Blue"
Geometry="M 0.4,0.6 L 0.5,0.8 0.6,0.6 0.5,0.5" />
<GeometryDrawing Brush="Black"
Geometry="M 0.4,0.4 L 0.2,0.5 0.4,0.6 0.5,0.5" />
<GeometryDrawing Brush="Green"
Geometry="M 0.6,0.4 L 0.8,0.5 0.6,0.6 0.5,0.5" />
</DrawingGroup.Children>
</DrawingGroup>
</Page.Resources>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Header -->
<Border Background="{StaticResource blueHorizontalGradientBrush}"
Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="12">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
This example shows how the Opacity property can be used to create brushes that are semi-transparent.
In the following examples, several different brushes are given
Opacity settings that range from 1.0 to 0.0.
</TextBlock>
</Border>
<!-- Labels for the different examples -->
<Rectangle Grid.Row="4" Grid.Column="2" Grid.RowSpan="9" Grid.ColumnSpan="9" Fill="{StaticResource checkeredBackground}" />
<TextBlock Grid.Row="2" Grid.Column="2">
Opacity: 1.0
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="4">
Opacity: 0.75
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="6">
Opacity: 0.5
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="8">
Opacity: 0.25
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="10">
Opacity: 0.0
</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0">
SolidColorBrush
</TextBlock>
<TextBlock Grid.Row="6" Grid.Column="0">
LinearGradientBrush
</TextBlock>
<TextBlock Grid.Row="8" Grid.Column="0">
RadialGradientBrush
</TextBlock>
<TextBlock Grid.Row="10" Grid.Column="0">
ImageBrush
</TextBlock>
<TextBlock Grid.Row="12" Grid.Column="0">
DrawingBrush
</TextBlock>
<!-- SolidColorBrush examples -->
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="2">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" Opacity="1" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="4">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" Opacity="0.75" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="6">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" Opacity="0.5" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="8">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="10">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" Opacity="0" />
</Rectangle.Fill>
</Rectangle>
<!-- LinearGradientBrush examples -->
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="2">
<Rectangle.Fill>
<LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="1" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="4">
<Rectangle.Fill>
<LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.75" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="6">
<Rectangle.Fill>
<LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.5" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="8">
<Rectangle.Fill>
<LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="10">
<Rectangle.Fill>
<LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0" />
</Rectangle.Fill>
</Rectangle>
<!-- RadialGradientBrush examples -->
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="2">
<Rectangle.Fill>
<RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="1.0" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="4">
<Rectangle.Fill>
<RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.75" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="6">
<Rectangle.Fill>
<RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.5" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="8">
<Rectangle.Fill>
<RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="10">
<Rectangle.Fill>
<RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0" />
</Rectangle.Fill>
</Rectangle>
<!-- ImageBrush examples -->
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="2">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="1.0" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="4">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0.75" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="6">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0.5" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="8">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="10">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0" />
</Rectangle.Fill>
</Rectangle>
<!-- DrawingBrush examples -->
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="2">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="1.0" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="4">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0.75" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="6">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0.5" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="8">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0.25" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="10">
<Rectangle.Fill>
<DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Style="{StaticResource footerRectangleStyle}" Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="12" Fill="{StaticResource blueHorizontalGradientBrush}" />
</Grid>
</Page>
@@ -0,0 +1,53 @@
<!-- <SnippetBrushTransformExampleWholePage> -->
<!-- BrushTransformExample.xaml
These examples show how to use the Brush.Transform
and Brush.RelativeTransform properites. -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="PresentationOptions"
Title="Transforming Brushes"
Background="White">
<StackPanel>
<!-- <SnippetImageBrushNoTransform> -->
<Rectangle Width="175" Height="90" Stroke="Black">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" />
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetImageBrushNoTransform> -->
<!-- <SnippetImageBrushRelativeTransformExample> -->
<Rectangle Width="175" Height="90" Stroke="Black">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg">
<ImageBrush.RelativeTransform>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="45" />
</ImageBrush.RelativeTransform>
</ImageBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetImageBrushRelativeTransformExample> -->
<!-- <SnippetImageBrushTransformExample> -->
<Rectangle Width="175" Height="90" Stroke="Black">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg">
<ImageBrush.Transform>
<RotateTransform CenterX="87.5" CenterY="45" Angle="45" />
</ImageBrush.Transform>
</ImageBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetImageBrushTransformExample> -->
</StackPanel>
</Page>
<!-- </SnippetBrushTransformExampleWholePage> -->
@@ -0,0 +1,131 @@
<!-- BrushTypes.xaml
Shows examples of several different brush types. TODO: scrollbar to see the whole example
-->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Different Types of Brushes">
<Page.Resources>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Stroke" Value="Black"/>
<Setter Property="StrokeThickness" Value="2"/>
<Setter Property="Margin" Value="20"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style TargetType="{x:Type Ellipse}">
<Setter Property="Stroke" Value="Black"/>
<Setter Property="StrokeThickness" Value="2"/>
<Setter Property="Margin" Value="0,0,5,5"/>
</Style>
</Page.Resources>
<StackPanel>
<!-- <SnippetGraphicsMMSolidColorBrushExampleInline> -->
<Rectangle Width="75" Height="75">
<Rectangle.Fill>
<SolidColorBrush Color="Red" />
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMSolidColorBrushExampleInline> -->
<!-- <SnippetGraphicsMMLinearGradientBrushExampleInline> -->
<Rectangle Width="75" Height="75">
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMLinearGradientBrushExampleInline> -->
<!-- <SnippetGraphicsMMRadialGradientBrushExampleInline> -->
<Rectangle Width="75" Height="75">
<Rectangle.Fill>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMRadialGradientBrushExampleInline> -->
<!-- <SnippetGraphicsMMImageBrushExampleInline> -->
<Rectangle Width="75" Height="75">
<Rectangle.Fill>
<ImageBrush ImageSource="sampleImages\pinkcherries.jpg" />
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMImageBrushExampleInline> -->
<!-- <SnippetGraphicsMMDrawingBrushExampleInline> -->
<Rectangle Width="75" Height="75">
<Rectangle.Fill>
<DrawingBrush Viewport="0,0,0.25,0.25" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="White">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,100,100" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Brush>
<LinearGradientBrush>
<GradientStop Offset="0.0" Color="Black" />
<GradientStop Offset="1.0" Color="Gray" />
</LinearGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMDrawingBrushExampleInline> -->
<!-- <SnippetGraphicsMMVisualBrushExampleInline> -->
<Rectangle Width="75" Height="75">
<Rectangle.Fill>
<VisualBrush TileMode="Tile">
<VisualBrush.Visual>
<StackPanel>
<StackPanel.Background>
<DrawingBrush>
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Brush>
<RadialGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop Color="White" Offset="1.0" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50" />
<RectangleGeometry Rect="50,50,50,50" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</StackPanel.Background>
<TextBlock FontSize="10pt" Margin="10">Hello, World!</TextBlock>
</StackPanel>
</VisualBrush.Visual>
</VisualBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </SnippetGraphicsMMVisualBrushExampleInline> -->
</StackPanel>
</Page>
@@ -0,0 +1,146 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<AssemblyName>BrushesIntroduction</AssemblyName>
<TargetType>$(OutputType)</TargetType>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>App.ico</ApplicationIcon>
<RootNamespace>BrushesIntroduction</RootNamespace>
<BuildSystem>MSBuild</BuildSystem>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9D37563A-C550-4347-9EEF-942BF2330B79}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>BrushesIntroduction.app</StartupObject>
<SignManifests>false</SignManifests>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<ProductVersion>10.0.20821</ProductVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<CodeAnalysisRules>
</CodeAnalysisRules>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.xml" />
<Reference Include="System.Data" />
<Reference Include="WindowsBase" />
<Reference Include="UIAutomationProvider" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationTypes" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="app.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="RadialGradientBrushSnippet.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SampleViewer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="BrushTypesExample.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SolidColorBrushSyntax.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PredefinedBrushes.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="AnimatingSolidColorBrushExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GradientBrushesExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="RadialGradientBrushExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GradientSpreadExample.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="RadialGradientBrushAnimationExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="LinearGradientBrushAnimationExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="InteractiveLinearGradientBrushExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="BrushOpacityExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="BrushTransformExample.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DashExample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GradientStopAnimationExample.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TileModeExample.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="GradientBrushesExample.xaml.cs">
<DependentUpon>GradientBrushesExample.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="SampleViewer.xaml.cs">
<DependentUpon>SampleViewer.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="app.xaml.cs">
<DependentUpon>app.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="InteractiveLinearGradientBrushExample.xaml.cs">
<DependentUpon>InteractiveLinearGradientBrushExample.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Resource Include="App.ico" />
<Resource Include="sampleImages\*.*" />
<Resource Include="sampleResources\TOC.xml" />
</ItemGroup>
</Project>
@@ -0,0 +1,92 @@
<!-- DashExample.xaml
This example shows how to create linear and radial gradients. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Dash Example">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Background="{StaticResource blueHorizontalGradientBrush}"
Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
The following examples show how to use dashes and offsets on a stroke to make dashed borders.
</TextBlock>
</Border>
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,10,0">
<Bold>StrokeDashArray</Bold>: 4,2<LineBreak/>
<Bold>StrokeDashOffset</Bold>: 0<LineBreak/>
</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="0" Width="150" Height="150"
StrokeDashArray="4 2" StrokeDashOffset="0"
Stroke="Black" StrokeThickness="3" Fill="Blue">
</Rectangle>
<TextBlock Grid.Row="2" Grid.Column="1" Margin="0,0,10,0">
<Bold>StrokeDashArray</Bold>: 4,2<LineBreak/>
<Bold>StrokeDashOffset</Bold>: 1<LineBreak/>
</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="1" Width="150" Height="150"
StrokeDashArray="4 2" StrokeDashOffset="1"
Stroke="Black" StrokeThickness="3" Fill="Blue">
</Rectangle>
<TextBlock Grid.Row="2" Grid.Column="2" >
<Bold>StrokeDashArray</Bold>: 4,2<LineBreak/>
<Bold>StrokeDashOffset</Bold>: 2<LineBreak/>
</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="2" Width="150" Height="150"
StrokeDashArray="4 2" StrokeDashOffset="2"
Stroke="Black" StrokeThickness="3" Fill="Blue">
</Rectangle>
<TextBlock Grid.Row="5" Grid.Column="0" >
<Bold>StrokeDashArray</Bold>: 4,1,4,3<LineBreak/>
<Bold>StrokeDashOffset</Bold>: 1<LineBreak/>
</TextBlock>
<Ellipse Grid.Row="6" Grid.Column="0" Width="150" Height="150"
StrokeDashArray="4 1 4 3" StrokeDashOffset="1"
Stroke="Black" StrokeThickness="3" Fill="Blue">
</Ellipse>
<TextBlock Grid.Row="5" Grid.Column="1" >
<Bold>StrokeDashArray</Bold>: 1,4,1,2<LineBreak/>
<Bold>StrokeDashOffset</Bold>: 1<LineBreak/>
</TextBlock>
<Ellipse Grid.Row="6" Grid.Column="1" Width="150" Height="150"
StrokeDashArray="1 4 1 2" StrokeDashOffset="1"
Stroke="Black" StrokeThickness="3" Fill="Blue">
</Ellipse>
<TextBlock Grid.Row="5" Grid.Column="2" >
<Bold>StrokeDashArray</Bold>: 1<LineBreak/>
<Bold>StrokeDashOffset</Bold>: 1<LineBreak/>
</TextBlock>
<Ellipse Grid.Row="6" Grid.Column="2" Width="150" Height="150"
StrokeDashArray="1" StrokeDashOffset="1"
Stroke="Black" StrokeThickness="3" Fill="Blue">
</Ellipse>
<Rectangle Style="{StaticResource footerRectangleStyle}"
Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="3"
Fill="{StaticResource blueHorizontalGradientBrush}"/>
</Grid>
</Page>
@@ -0,0 +1,249 @@
<!-- GradientBrushesExample.xaml
This example shows how to create linear and radial gradients. -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="BrushesIntroduction.GradientBrushesExample"
Loaded="pageLoaded"
Title="Gradient Brushes">
<Page.Resources>
<Style x:Key="axisMarkerStyle">
<Setter Property="Line.StrokeThickness" Value="2"/>
<Setter Property="Line.Stroke" Value="Black"/>
<Setter Property="Line.StrokeDashArray" Value="2,1"/>
<Setter Property="Line.StrokeEndLineCap" Value="Flat"/>
<Setter Property="Line.StrokeStartLineCap" Value="Flat"/>
<Style.Triggers>
<EventTrigger RoutedEvent="Path.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset"
From="3" To="0" Duration="0:0:1" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<Style x:Key="gradientMarkerStyle">
<Setter Property="Path.Fill" Value="#99FFFFFF"/>
<Setter Property="Path.Stroke" Value="Black"/>
<Setter Property="Path.StrokeThickness" Value="2"/>
</Style>
<Style TargetType="{x:Type Canvas}">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="5"/>
</Style>
</Page.Resources>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Header -->
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5"
Background="{StaticResource blueHorizontalGradientBrush}">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
This example shows linear and radial gradients. Gradient stop locations are marked with circles,
and gradient axis locations are marked with dashed lines.
</TextBlock>
</Border>
<Rectangle Grid.Row="1" Grid.Column="0" RadiusX="10" RadiusY="10"
Fill="#773333CC" Margin="0,5,0,5" />
<CheckBox Name="showHideGradientStopsCheckBox"
IsChecked="True" Margin="10"
Grid.Row="1" Grid.Column="0">
Highlight Gradient Stops>
</CheckBox>
<Canvas Grid.Row="3" Grid.Column="0" Width="200" Height="100">
<!-- <Snippet3> -->
<!-- This rectangle is painted with a diagonal linear gradient. -->
<Rectangle Width="200" Height="100">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </Snippet3> -->
<!-- Highlights the position of the brush's gradient stops. -->
<Line X1="1" Y1="1" X2="199" Y2="99" Style="{StaticResource axisMarkerStyle}" Name="gradientLine1" />
<Path Style="{StaticResource gradientMarkerStyle}" Name="gradientPath1">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="0,0" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="50,25" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="150,75" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="200,100" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
<Canvas Grid.Row="3" Grid.Column="2" Width="200" Height="100">
<!-- <Snippet4> -->
<!-- This rectangle is painted with a horizontal linear gradient. -->
<Rectangle Width="200" Height="100">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </Snippet4> -->
<!-- Highlights the position of the brush's gradient stops. -->
<Line X1="1" Y1="50" X2="199" Y2="50" Style="{StaticResource axisMarkerStyle}" Name="gradientLine2"/>
<Path Style="{StaticResource gradientMarkerStyle}" Name="gradientPath2">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="0,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="50,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="150,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="200,50" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
<Canvas Grid.Row="3" Grid.Column="4" Width="200" Height="100">
<!-- This rectangle is painted with a horizontal linear gradient.
Because the StartPoint is (0.25,0.5) and the EndPoint is (0.75,0.5),
the gradient doesn't completely fill the output area. The remaining
portion of the rectangle is filled based on the brush's SpreadMethod setting.
In this case, the SpreadMethod isn't specified, so the brush defaults to
Pad. -->
<Rectangle Width="200" Height="100">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.25,0.5" EndPoint="0.75,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- Highlights the position of the brush's gradient stops. -->
<Line X1="49" Y1="50" X2="149" Y2="50" Style="{StaticResource axisMarkerStyle}" Name="gradientLine3" />
<Path Style="{StaticResource gradientMarkerStyle}" Name="gradientPath3">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="50,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="75,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="125,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="150,50" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
<Canvas Grid.Row="5" Grid.Column="0" Width="200" Height="100">
<!-- <Snippet5> -->
<!-- This rectangle is painted with a vertical gradient. -->
<Rectangle Width="200" Height="100">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </Snippet5> -->
<!-- Highlights the position of the brush's gradient stops. -->
<Line X1="100" Y1="1" X2="100" Y2="99" Style="{StaticResource axisMarkerStyle}" Name="gradientLine4" />
<Path Style="{StaticResource gradientMarkerStyle}" Name="gradientPath4">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="100,0" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="100,25" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="100,75" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="100,100" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
<Canvas Grid.Row="5" Grid.Column="2" Width="200" Height="100">
<!-- <Snippet6> -->
<!-- This rectangle is painted with a radial gradient. -->
<Rectangle Width="200" Height="100">
<Rectangle.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- </Snippet6> -->
<!-- Highlights the position of the brush's gradient stops. -->
<Line X1="101" Y1="50" X2="199" Y2="50" Style="{StaticResource axisMarkerStyle}" Name="gradientLine5" />
<Path Style="{StaticResource gradientMarkerStyle}" Name="gradientPath5">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="100,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="125,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="175,50" RadiusX="4" RadiusY="4" />
<EllipseGeometry Center="200,50" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
<!-- Labels the examples. -->
<TextBlock Grid.Row="2" Grid.Column="0">Diagonal linear gradient</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="2">Horizontal linear gradient</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="4">Condensed horizontal linear gradient</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0">Vertical linear gradient</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="2">Radial gradient</TextBlock>
<!-- Footer -->
<Rectangle
Style="{StaticResource footerRectangleStyle}"
Grid.Row="7" Grid.ColumnSpan="5"
Fill="{StaticResource blueHorizontalGradientBrush}" />
</Grid>
</Page>
@@ -0,0 +1,60 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Input;
using System.Windows.Media;
namespace BrushesIntroduction
{
/// <summary>
/// Implements the show/hide gradient stops functionlity for
/// GradientBrushesExample.xaml.
/// </summary>
public partial class GradientBrushesExample : Page
{
public GradientBrushesExample()
{
InitializeComponent();
}
private void pageLoaded(object sender, RoutedEventArgs args)
{
showHideGradientStopsCheckBox.Checked += new RoutedEventHandler(showGradientStops);
showHideGradientStopsCheckBox.Unchecked += new RoutedEventHandler(hideGradientStops);
}
private void showGradientStops(object sender, RoutedEventArgs args)
{
gradientLine1.Opacity = 1.0;
gradientLine2.Opacity = 1.0;
gradientLine3.Opacity = 1.0;
gradientLine4.Opacity = 1.0;
gradientLine5.Opacity = 1.0;
gradientPath1.Opacity = 1.0;
gradientPath2.Opacity = 1.0;
gradientPath3.Opacity = 1.0;
gradientPath4.Opacity = 1.0;
gradientPath5.Opacity = 1.0;
}
private void hideGradientStops(object sender, RoutedEventArgs args)
{
gradientLine1.Opacity = 0.0;
gradientLine2.Opacity = 0.0;
gradientLine3.Opacity = 0.0;
gradientLine4.Opacity = 0.0;
gradientLine5.Opacity = 0.0;
gradientPath1.Opacity = 0.0;
gradientPath2.Opacity = 0.0;
gradientPath3.Opacity = 0.0;
gradientPath4.Opacity = 0.0;
gradientPath5.Opacity = 0.0;
}
}
}
@@ -0,0 +1,83 @@
<!-- GradientSpreadExample.xaml
This example shows the different gradient spread methods applied to
linear and radial gradient brushes. -->
<!-- <SnippetGraphicsmmGradientSpreadExampleWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Gradient Spread Methods">
<StackPanel>
<!-- The following three examples show the different gradient spread methods
applied to linear gradient brushes. -->
<Rectangle Width="150" Height="75" Stroke="Black">
<Rectangle.Fill>
<!-- Pad -->
<LinearGradientBrush StartPoint="0.3,0.5" EndPoint="0.7,0.5" SpreadMethod="Pad">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#333333" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="150" Height="75" Stroke="Black">
<Rectangle.Fill>
<!-- Reflect -->
<LinearGradientBrush StartPoint="0.3,0.5" EndPoint="0.7,0.5" SpreadMethod="Reflect">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#333333" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="150" Height="75" Stroke="Black">
<Rectangle.Fill>
<!-- Repeat -->
<LinearGradientBrush StartPoint="0.3,0.5" EndPoint="0.7,0.5" SpreadMethod="Repeat">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#333333" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- The following three examples show the different gradient spread methods
applied to radial gradient brushes. -->
<Rectangle Width="150" Height="75" Stroke="Black">
<Rectangle.Fill>
<!-- Pad -->
<RadialGradientBrush Center="0.5,0.5" RadiusX="0.3" RadiusY="0.3" SpreadMethod="Pad">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#333333" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="150" Height="75" Stroke="Black">
<Rectangle.Fill>
<!-- Reflect -->
<RadialGradientBrush Center="0.5,0.5" RadiusX="0.3" RadiusY="0.3" SpreadMethod="Reflect">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#333333" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="150" Height="75" Stroke="Black">
<Rectangle.Fill>
<!-- Repeat -->
<RadialGradientBrush Center="0.5,0.5" RadiusX="0.3" RadiusY="0.3" SpreadMethod="Repeat">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#333333" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Page>
<!-- </SnippetGraphicsmmGradientSpreadExampleWholePage> -->
@@ -0,0 +1,61 @@
<!--
Shows how to animate a LinearGradientBrush and
its gradient stops.
-->
<!-- <SnippetGraphicsMMGradientAnimationExamplesWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="GradientStop Animation Example"
Background="White">
<StackPanel Margin="10">
<!-- <SnippetGraphicsMMGradientAnimationInline> -->
<Rectangle
Width="200"
Height="100"
Stroke="Black" StrokeThickness="1">
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop x:Name="GradientStop1" Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="GradientStop2" Color="Purple" Offset="0.5" />
<GradientStop x:Name="GradientStop3" Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="GradientStop1"
Storyboard.TargetProperty="Offset"
From="0.0" To="1.0" Duration="0:0:1.5"
AutoReverse="True" />
<ColorAnimation
Storyboard.TargetName="GradientStop2"
Storyboard.TargetProperty="Color"
From="Purple" To="Yellow"
Duration="0:0:1.5"
AutoReverse="True"
BeginTime="0:0:3" />
<ColorAnimation
Storyboard.TargetName="GradientStop3"
Storyboard.TargetProperty="Color"
Duration="0:0:1.5"
AutoReverse="True"
BeginTime="0:0:6">
<ColorAnimation.By>
<Color ScA="-1" ScR="0" ScB="0" ScG="0" />
</ColorAnimation.By>
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<!-- </SnippetGraphicsMMGradientAnimationInline> -->
</StackPanel>
</Page>
<!-- </SnippetGraphicsMMGradientAnimationExamplesWholePage> -->
@@ -0,0 +1,365 @@
<!--
InteractiveLinearGradientBrushExample.xaml
Enables the user to interactively configure a LinearGradientBrush.
-->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="BrushesIntroduction.InteractiveLinearGradientBrushExample"
xmlns:local="clr-namespace:BrushesIntroduction"
WindowTitle="Interactive LinearGradientBrush Example"
Loaded="onPageLoaded">
<Page.Resources>
<Style x:Key="EntryLabelStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="0,0,5,0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
<local:EnumPossibleValuesToStringArrayConverter x:Key="EnumStringConverterResource"/>
<local:PointToStringConverter x:Key="PointToStringConverterResource"/>
<local:DoubleToStringConverter x:Key="DoubleToStringConverterResource"/>
</Page.Resources>
<DockPanel Margin="10">
<!-- Header -->
<Border Background="{StaticResource blueHorizontalGradientBrush}" DockPanel.Dock="Top">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}" >
<Bold>Interactive LinearGradientBrush Example</Bold><LineBreak />
This example enables you to preview the effects of
setting LinearGradientBrush properties.
</TextBlock>
</Border>
<!-- Footer -->
<Rectangle
DockPanel.Dock="Bottom"
Style="{StaticResource footerRectangleStyle}"
Fill="{StaticResource blueHorizontalGradientBrush}" />
<Border DockPanel.Dock="Top" Margin="0,10,0,0">
<StackPanel>
<TextBlock Margin="0,20,0,0" Text="Brush Settings" />
<Border Background="LightGray" Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="5" />
<RowDefinition Height="Auto" />
<RowDefinition Height="5" />
<RowDefinition Height="Auto" />
<RowDefinition Height="5" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- StartPoint -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="0"
Text="StartPoint:" />
<TextBox
Name="StartPointTextBox"
Grid.Column="1" Grid.Row="0"
Text="0.0000,0.0000"
KeyUp="onStartPointTextBoxKeyUp" />
<!-- EndPoint -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="3" Grid.Row="0"
Text="EndPoint:" />
<TextBox
Name="EndPointTextBox"
Grid.Column="4" Grid.Row="0"
Text="1.0000, 1.0000"
KeyUp="onEndPointTextBoxKeyUp"/>
<!-- MappingMode -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="2"
Text="MappingMode:" />
<ComboBox
Name="MappingModeComboBox"
Grid.Column="1" Grid.Row="2"
SelectedIndex="1"
SelectedItem="{Binding ElementName='InteractiveLinearGradientBrush', Path='MappingMode'}"
ItemsSource="{Binding ElementName='InteractiveLinearGradientBrush', Path='MappingMode', Converter={StaticResource EnumStringConverterResource}}"
Padding="5"
/>
<!-- SpreadMode -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="3" Grid.Row="2"
Text="SpreadMode:" />
<ComboBox
Grid.Column="4" Grid.Row="2"
SelectedItem="{Binding ElementName='InteractiveLinearGradientBrush', Path='SpreadMethod'}"
SelectedIndex="0"
ItemsSource="{Binding ElementName='InteractiveLinearGradientBrush', Path='SpreadMethod', Converter={StaticResource EnumStringConverterResource}}"
Padding="5"
/>
<!-- ColorInterpolationMode -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="4"
Text="ColorInterpolationMode:" />
<ComboBox
Grid.Column="1" Grid.Row="4"
SelectedIndex="1"
SelectedItem="{Binding ElementName='InteractiveLinearGradientBrush', Path='ColorInterpolationMode'}"
ItemsSource="{Binding ElementName='InteractiveLinearGradientBrush', Path='ColorInterpolationMode', Converter={StaticResource EnumStringConverterResource}}"
Padding="5"
/>
<!-- Opacity -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="6"
Text="Opacity:" />
<Slider
Grid.Column="1" Grid.Row="6"
Grid.ColumnSpan="4"
Minimum="0" Maximum="1"
Value="{Binding ElementName='InteractiveLinearGradientBrush', Path='Opacity'}" />
</Grid>
</Border>
<!-- Interactive Gradient Stop Controls -->
<TextBlock Margin="0,20,0,0" Text="Gradient Stops" />
<Border Background="LightGray" Padding="10">
<Grid Margin="20,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="5" />
<RowDefinition Height="Auto" />
<RowDefinition Height="5" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Gradient Stop 1 -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="0"
FontWeight="Bold"
Margin="0,0,20,0"
Text="Stop 1" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="1" Grid.Row="0"
Text="Color:" />
<TextBox
Grid.Column="2" Grid.Row="0"
Text="{Binding ElementName='GradientStop1', Path='Color'}" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="4" Grid.Row="0"
Text="Offset:" />
<Slider
Grid.Column="5" Grid.Row="0"
Minimum="0" Maximum="1"
Width="100"
Value="{Binding ElementName='GradientStop1', Path='Offset'}" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="6" Grid.Row="0"
FontFamily="Courier"
Margin="20,0,0,0"
Text="{Binding ElementName='GradientStop1', Path='Offset',
Converter='{StaticResource DoubleToStringConverterResource}'}" />
<!-- Gradient Stop 2 -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="2"
FontWeight="Bold"
Margin="0,0,20,0"
Text="Stop 2" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="1" Grid.Row="2"
Text="Color:" />
<TextBox
Grid.Column="2" Grid.Row="2"
Text="{Binding ElementName='GradientStop2', Path='Color'}" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="4" Grid.Row="2"
Text="Offset:" />
<Slider
Grid.Column="5" Grid.Row="2"
Minimum="0" Maximum="1"
Width="100"
Value="{Binding ElementName='GradientStop2', Path='Offset'}" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="6" Grid.Row="2"
FontFamily="Courier"
Margin="20,0,0,0"
Text="{Binding ElementName='GradientStop2', Path='Offset',
Converter='{StaticResource DoubleToStringConverterResource}'}" />
<!-- Gradient Stop 3 -->
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="0" Grid.Row="4"
FontWeight="Bold"
Margin="0,0,20,0"
Text="Stop 3" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="1" Grid.Row="4"
Text="Color:" />
<TextBox
Grid.Column="2" Grid.Row="4"
Text="{Binding ElementName='GradientStop3', Path='Color'}" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="4" Grid.Row="4"
Text="Offset:" />
<Slider
Grid.Column="5" Grid.Row="4"
Minimum="0" Maximum="1"
Width="100"
Value="{Binding ElementName='GradientStop3', Path='Offset'}" />
<TextBlock
Style="{StaticResource EntryLabelStyle}"
Grid.Column="6" Grid.Row="4"
FontFamily="Courier"
Margin="20,0,0,0"
Text="{Binding ElementName='GradientStop3',
Path='Offset',
Converter='{StaticResource DoubleToStringConverterResource}'}" />
</Grid>
</Border>
</StackPanel>
</Border>
<!-- Displays markup that describes the brush. -->
<Expander Header="Markup" DockPanel.Dock="Top" Margin="0,10,0,0"
BorderBrush="Black" BorderThickness="1" >
<Border Background="LightGray"
BorderBrush="Gray" BorderThickness="1"
Padding="5">
<TextBlock Name="markupOutputTextBlock" FontFamily="Courier" />
</Border>
</Expander>
<Border Name="GradientDisplayElement"
SizeChanged="gradientDisplaySizeChanged"
MouseLeftButtonDown="gradientDisplayMouseLeftButtonDown"
MouseLeftButtonUp="gradientDisplayMouseLeftButtonUp"
MouseMove="gradientDisplayMouseMove"
Margin="20"
Height="200" Width="400">
<Border.Background>
<LinearGradientBrush
x:Name="InteractiveLinearGradientBrush"
Changed="onInteractiveLinearGradientBrushChanged">
<GradientStop x:Name="GradientStop1" Offset="0" Color="Blue" />
<GradientStop x:Name="GradientStop2" Offset="0.5" Color="Purple" />
<GradientStop x:Name="GradientStop3" Offset="1" Color="Red" />
</LinearGradientBrush>
</Border.Background>
<Canvas
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Line
Stroke="Black" StrokeThickness="3"
StrokeDashArray="2,1"
X1="{Binding ElementName=StartPointMarkerTranslateTransform, Path=X}"
Y1="{Binding ElementName=StartPointMarkerTranslateTransform, Path=Y}"
X2="{Binding ElementName=EndPointMarkerTranslateTransform, Path=X}"
Y2="{Binding ElementName=EndPointMarkerTranslateTransform, Path=Y}">
</Line>
<!-- Marks the brush's StartPoint. -->
<Ellipse
Name="StartPointMarker"
Style="{StaticResource MarkerEllipseStyle}"
Canvas.Left="-10" Canvas.Top="-10">
<Ellipse.RenderTransform>
<TranslateTransform
x:Name="StartPointMarkerTranslateTransform"
X="0" Y="0" />
</Ellipse.RenderTransform>
</Ellipse>
<!-- Marks the brush's EndPointPoint. -->
<Ellipse
Name="EndPointMarker"
Style="{StaticResource MarkerEllipseStyle}"
Canvas.Left="-10" Canvas.Top="-10">
<Ellipse.RenderTransform>
<TranslateTransform
x:Name="EndPointMarkerTranslateTransform"
X="0" Y="0" />
</Ellipse.RenderTransform>
</Ellipse>
<!-- Labels the StartPoint marker. -->
<Label Content="StartPoint">
<Label.RenderTransform>
<TranslateTransform
X="{Binding ElementName=StartPointMarkerTranslateTransform, Path=X}"
Y="{Binding ElementName=StartPointMarkerTranslateTransform, Path=Y}" />
</Label.RenderTransform>
</Label>
<!-- Labels the EndPoint marker. -->
<Label Content="EndPoint">
<Label.RenderTransform>
<TranslateTransform
X="{Binding ElementName=EndPointMarkerTranslateTransform, Path=X}"
Y="{Binding ElementName=EndPointMarkerTranslateTransform, Path=Y}" />
</Label.RenderTransform>
</Label>
</Canvas>
</Border>
</DockPanel>
</Page>
@@ -0,0 +1,363 @@
using System;
using System.Windows;
using System.Windows.Data;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace BrushesIntroduction
{
/// <summary>
/// Enables the user to configure a LinearGradientBrush interactively.
/// </summary>
public partial class InteractiveLinearGradientBrushExample : Page
{
public InteractiveLinearGradientBrushExample()
{
InitializeComponent();
}
private void onPageLoaded(object sender, RoutedEventArgs s)
{
MappingModeComboBox.SelectionChanged += new SelectionChangedEventHandler(mappingModeChanged);
onStartPointTextBoxKeyUp(StartPointTextBox, null);
onEndPointTextBoxKeyUp(EndPointTextBox, null);
}
// Update the StartPoint and EndPoint markers when the gradient display
// element's size changes.
private void gradientDisplaySizeChanged(object sender, SizeChangedEventArgs e)
{
// The marker positions only need recalcutated if the brush's MappingMode
// is RelativeToBoundingBox.
if (InteractiveLinearGradientBrush.MappingMode ==
BrushMappingMode.RelativeToBoundingBox)
{
StartPointMarkerTranslateTransform.X =
InteractiveLinearGradientBrush.StartPoint.X * e.NewSize.Width;
StartPointMarkerTranslateTransform.Y =
InteractiveLinearGradientBrush.StartPoint.Y * e.NewSize.Height;
EndPointMarkerTranslateTransform.X =
InteractiveLinearGradientBrush.EndPoint.X * e.NewSize.Width;
EndPointMarkerTranslateTransform.Y =
InteractiveLinearGradientBrush.EndPoint.Y * e.NewSize.Height;
}
}
private void onStartPointTextBoxKeyUp(object sender, KeyEventArgs args)
{
TextBox t = (TextBox)sender;
try
{
Point p = Point.Parse(t.Text);
if (InteractiveLinearGradientBrush.MappingMode == BrushMappingMode.RelativeToBoundingBox)
{
StartPointMarkerTranslateTransform.X = p.X * GradientDisplayElement.ActualWidth;
StartPointMarkerTranslateTransform.Y = p.Y * GradientDisplayElement.ActualHeight;
}
else
{
StartPointMarkerTranslateTransform.X = p.X;
StartPointMarkerTranslateTransform.Y = p.Y;
}
}
catch (InvalidOperationException ex)
{
// Ignore errors.
}
catch (FormatException formatEx)
{
// Ignore errors.
}
}
private void onEndPointTextBoxKeyUp(object sender, KeyEventArgs args)
{
TextBox t = (TextBox)sender;
try
{
Point p = Point.Parse(t.Text);
if (InteractiveLinearGradientBrush.MappingMode == BrushMappingMode.RelativeToBoundingBox)
{
EndPointMarkerTranslateTransform.X = p.X * GradientDisplayElement.ActualWidth;
EndPointMarkerTranslateTransform.Y = p.Y * GradientDisplayElement.ActualHeight;
}
else
{
EndPointMarkerTranslateTransform.X = p.X;
EndPointMarkerTranslateTransform.Y = p.Y;
}
}
catch (InvalidOperationException ex)
{
// Ignore errors.
}
catch (FormatException formatEx)
{
// Ignore errors.
}
}
// Determine whether the user clicked a marker.
private void gradientDisplayMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.OriginalSource is Shape)
{
SetValue(SelectedMarkerProperty, (Shape)e.OriginalSource);
}
else
{
SetValue(SelectedMarkerProperty, null);
}
}
// Determines whether the user just finished dragging a marker. If so,
// this method updates the brush's StartPoint or EndPoint property,
// depending on which marker was dragged.
private void gradientDisplayMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Point clickPoint = e.GetPosition(GradientDisplayElement);
Shape s = (Shape)GetValue(SelectedMarkerProperty);
if (s == EndPointMarker || s == StartPointMarker)
{
TranslateTransform translation = (TranslateTransform)s.RenderTransform;
translation.X = clickPoint.X;
translation.Y = clickPoint.Y;
SetValue(SelectedMarkerProperty, null);
Mouse.Synchronize();
Point p;
if (InteractiveLinearGradientBrush.MappingMode == BrushMappingMode.RelativeToBoundingBox)
{
p = new Point(clickPoint.X / GradientDisplayElement.ActualWidth,
clickPoint.Y / GradientDisplayElement.ActualHeight);
}
else
{
p = clickPoint;
}
if (s == StartPointMarker)
{
InteractiveLinearGradientBrush.StartPoint = p;
StartPointTextBox.Text = p.X.ToString("F4") + "," + p.Y.ToString("F4");
}
else
{
InteractiveLinearGradientBrush.EndPoint = p;
EndPointTextBox.Text = p.X.ToString("F4") + "," + p.Y.ToString("F4");
}
}
}
// Update the StartPoint or EndPoint when the user drags one of the
// points with the mouse.
private void gradientDisplayMouseMove(object sender, MouseEventArgs e)
{
Point currentPoint = e.GetPosition(GradientDisplayElement);
Shape s = (Shape)GetValue(SelectedMarkerProperty);
// Determine whether the user dragged a StartPoint or
// EndPoint marker.
if (s == EndPointMarker || s == StartPointMarker)
{
// Move the selected marker to the current mouse position.
TranslateTransform translation = (TranslateTransform)s.RenderTransform;
translation.X = currentPoint.X;
translation.Y = currentPoint.Y;
Mouse.Synchronize();
Point p;
// Calculate the StartPoint or EndPoint.
if (InteractiveLinearGradientBrush.MappingMode ==
BrushMappingMode.RelativeToBoundingBox)
{
// If the MappingMode is relative, compute the relative
// value of the new point.
p = new Point(currentPoint.X / GradientDisplayElement.ActualWidth,
currentPoint.Y / GradientDisplayElement.ActualHeight);
}
else
{
// If the MappingMode is absolute, there's no more
// work to do.
p = currentPoint;
}
if (s == StartPointMarker)
{
// If the selected marker is the StartPoint marker,
// update the brush's StartPoint.
InteractiveLinearGradientBrush.StartPoint = p;
StartPointTextBox.Text = p.X.ToString("F4") + "," + p.Y.ToString("F4");
}
else
{
// Otherwise, update the brush's EndPoint.
InteractiveLinearGradientBrush.EndPoint = p;
EndPointTextBox.Text = p.X.ToString("F4") + "," + p.Y.ToString("F4");
}
}
}
// Updates the StartPoint and EndPoint and their markers when
// the user changes the brush's MappingMode.
private void mappingModeChanged(object sender, SelectionChangedEventArgs e)
{
Point oldStartPoint = InteractiveLinearGradientBrush.StartPoint;
Point newStartPoint = new Point();
Point oldEndPoint = InteractiveLinearGradientBrush.EndPoint;
Point newEndPoint = new Point();
if (InteractiveLinearGradientBrush.MappingMode ==
BrushMappingMode.RelativeToBoundingBox)
{
// The MappingMode changed from absolute to relative.
// To find the new relative point, divide the old absolute points
// by the painted area's width and height.
newStartPoint.X = oldStartPoint.X / GradientDisplayElement.ActualWidth;
newStartPoint.Y = oldStartPoint.Y / GradientDisplayElement.ActualHeight;
InteractiveLinearGradientBrush.StartPoint = newStartPoint;
newEndPoint.X = oldEndPoint.X / GradientDisplayElement.ActualWidth;
newEndPoint.Y = oldEndPoint.Y / GradientDisplayElement.ActualHeight;
InteractiveLinearGradientBrush.EndPoint = newEndPoint;
}
else
{
// The MappingMode changed from relative to absolute.
// To find the new absolute point, multiply the old relative points
// by the painted area's width and height.
newStartPoint.X = oldStartPoint.X * GradientDisplayElement.ActualWidth;
newStartPoint.Y = oldStartPoint.Y * GradientDisplayElement.ActualHeight;
InteractiveLinearGradientBrush.StartPoint = newStartPoint;
newEndPoint.X = oldEndPoint.X * GradientDisplayElement.ActualWidth;
newEndPoint.Y = oldEndPoint.Y * GradientDisplayElement.ActualHeight;
InteractiveLinearGradientBrush.EndPoint = newEndPoint;
}
// Update the StartPoint and EndPoint display text.
StartPointTextBox.Text = newStartPoint.X.ToString("F4") +
"," + newStartPoint.Y.ToString("F4");
EndPointTextBox.Text = newEndPoint.X.ToString("F4") +
"," + newEndPoint.Y.ToString("F4");
}
// Update the markup display whenever the brush changes.
private void onInteractiveLinearGradientBrushChanged(object sender, EventArgs e)
{
if (GradientDisplayElement != null)
{
markupOutputTextBlock.Text =
generateLinearGradientBrushMarkup(InteractiveLinearGradientBrush);
}
}
// Helper method that displays the markup of interest for
// creating the specified brush.
private static string generateLinearGradientBrushMarkup(LinearGradientBrush theBrush)
{
System.Text.StringBuilder sBuilder = new System.Text.StringBuilder();
sBuilder.Append("<" + theBrush.GetType().Name + "\n" +
" StartPoint=\"" + theBrush.StartPoint.ToString() + "\"" +
" EndPoint=\"" + theBrush.EndPoint.ToString() + "\" \n" +
" MappingMode=\"" + theBrush.MappingMode.ToString() + "\"" +
" SpreadMethod=\"" + theBrush.SpreadMethod.ToString() + "\"\n" +
" ColorInterpolationMode=\"" + theBrush.ColorInterpolationMode.ToString() + "\"" +
" Opacity=\"" + theBrush.Opacity.ToString() + "\"" + ">\n");
foreach (GradientStop stop in theBrush.GradientStops)
{
sBuilder.Append
(
" <GradientStop Offset=\"" + stop.Offset.ToString("F4")
+ "\" Color=\"" + stop.Color.ToString() + "\" />\n"
);
}
sBuilder.Append("</LinearGradientBrush>");
return sBuilder.ToString();
}
public static readonly DependencyProperty SelectedMarkerProperty =
DependencyProperty.Register
("SelectedMarker", typeof(Shape), typeof(InteractiveLinearGradientBrushExample),
new PropertyMetadata(null));
}
[ValueConversion(typeof(object), typeof(string[]))]
public class EnumPossibleValuesToStringArrayConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return new System.Collections.ArrayList(Enum.GetNames(value.GetType()));
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
[ValueConversion(typeof(Point), typeof(string))]
public class PointToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Point p = (Point)value;
return p.X.ToString("F4") + "," + p.Y.ToString("F4");
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
return Point.Parse((string)value);
}
catch (System.InvalidOperationException ex)
{
return null;
}
}
}
[ValueConversion(typeof(double), typeof(string))]
public class DoubleToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double d = (double)value;
return d.ToString("F4");
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
return Double.Parse((string)value);
}
catch (System.InvalidOperationException ex)
{
return null;
}
}
}
}
@@ -0,0 +1,230 @@
<!-- LinearGradientBrushAnimationExample.xaml
Shows how to animate a LinearGradientBrush and
its gradient stops.
-->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="LinearGradientBrush Animation Example">
<Page.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Background" Value="White" />
<Setter Property="Padding" Value="10" />
<Setter Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="White" />
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="BitmapEffect">
<Setter.Value>
<DropShadowBitmapEffect />
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<DockPanel>
<!-- Header -->
<Border Margin="10"
Background="{StaticResource blueHorizontalGradientBrush}"
DockPanel.Dock="Top">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}" >
The following examples show several different ways of animating
LinearGradientBrush objects.
Left-click the shapes to begin their animations.
</TextBlock>
</Border>
<!-- Footer -->
<Rectangle Margin="10"
DockPanel.Dock="Bottom"
Style="{StaticResource footerRectangleStyle}"
Fill="{StaticResource blueHorizontalGradientBrush}" />
<Border>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="10" Background="{StaticResource checkeredBackground}">
<TextBlock>Animated GradientStop Offset</TextBlock>
<!-- <SnippetGraphicsMMGradientOffsetAnimationInline> -->
<Rectangle Name="animatedGradientStopOffsetExampleRectangle"
Width="200"
Height="100" Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="gradientStopA2" Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="gradientStopA2"
Storyboard.TargetProperty="Offset"
From="0.0" To="1.0" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<!-- </SnippetGraphicsMMGradientOffsetAnimationInline> -->
<TextBlock>Animated GradientStop Color</TextBlock>
<!-- <SnippetGraphicsMMGradientColorAnimationInline> -->
<Rectangle Name="animatedGradientStopColorExampleRectangle"
Width="200" Height="100"
Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="gradientStopB2" Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="gradientStopB2"
Storyboard.TargetProperty="Color"
From="Purple" To="Yellow" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<!-- </SnippetGraphicsMMGradientColorAnimationInline> -->
<TextBlock>Animated GradientStop Opacity</TextBlock>
<Rectangle Name="animatedGradientStopOpacityExampleRectangle"
Width="200" Height="100" Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="gradientStopC2" Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="gradientStopC2"
Storyboard.TargetProperty="Color"
Duration="0:0:3" FillBehavior="Stop">
<ColorAnimation.By>
<Color ScA="-1" ScR="0" ScB="0" ScG="0" />
</ColorAnimation.By>
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</StackPanel>
<StackPanel Margin="10" Background="{StaticResource checkeredBackground}">
<TextBlock>Animated StartPoint</TextBlock>
<Rectangle
Width="200"
Height="100" Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<LinearGradientBrush x:Name="animatedStartPointExample">
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<PointAnimation
Storyboard.TargetName="animatedStartPointExample"
Storyboard.TargetProperty="StartPoint"
From="0,0" To="0.5,1" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<TextBlock>Animated EndPoint</TextBlock>
<Rectangle
Width="200" Height="100" Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<LinearGradientBrush x:Name="animatedEndPointExample"
StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<PointAnimation
Storyboard.TargetName="animatedEndPointExample"
Storyboard.TargetProperty="EndPoint"
From="1,1" To="0.5,0" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<TextBlock>Animated StartPoint and EndPoint</TextBlock>
<Rectangle
Width="200" Height="100" Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<LinearGradientBrush x:Name="animatedStartPointEndPointExample">
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<PointAnimation
Storyboard.TargetName="animatedStartPointEndPointExample"
Storyboard.TargetProperty="StartPoint"
From="0,0" To="0.5,1" Duration="0:0:3" FillBehavior="Stop" />
<PointAnimation
Storyboard.TargetName="animatedStartPointEndPointExample"
Storyboard.TargetProperty="EndPoint"
From="1,1" To="0.5,0" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</StackPanel>
</StackPanel>
</Border>
</DockPanel>
</Page>
@@ -0,0 +1,509 @@
<!-- PredefinedBrushes.xaml
Shows the predefined brushes defined by the System.Brushes class.
-->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Predefined Brushes">
<Grid Margin="10">
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="8pt"/>
<Setter Property="FontFamily" Value="Verdana"/>
<Setter Property="Margin" Value="5,5,0,0"/>
</Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Stroke" Value="Black"/>
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="Margin" Value="20,5,0,0"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0"
Grid.ColumnSpan="12" FontSize="14" FontWeight="Bold">Predefined Brushes</TextBlock>
<Rectangle Grid.Row="2" Grid.Column="0" Width="30" Height="14" Fill="AliceBlue" />
<TextBlock Grid.Row="2" Grid.Column="1">AliceBlue</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="2">#FFF0F8FF</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="0" Width="30" Height="14" Fill="AntiqueWhite" />
<TextBlock Grid.Row="3" Grid.Column="1">AntiqueWhite</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="2">#FFFAEBD7</TextBlock>
<Rectangle Grid.Row="4" Grid.Column="0" Width="30" Height="14" Fill="Aqua" />
<TextBlock Grid.Row="4" Grid.Column="1">Aqua</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="2">#FF00FFFF</TextBlock>
<Rectangle Grid.Row="5" Grid.Column="0" Width="30" Height="14" Fill="Aquamarine" />
<TextBlock Grid.Row="5" Grid.Column="1">Aquamarine</TextBlock>
<TextBlock Grid.Row="5" Grid.Column="2">#FF7FFFD4</TextBlock>
<Rectangle Grid.Row="6" Grid.Column="0" Width="30" Height="14" Fill="Azure" />
<TextBlock Grid.Row="6" Grid.Column="1">Azure</TextBlock>
<TextBlock Grid.Row="6" Grid.Column="2">#FFF0FFFF</TextBlock>
<Rectangle Grid.Row="7" Grid.Column="0" Width="30" Height="14" Fill="Beige" />
<TextBlock Grid.Row="7" Grid.Column="1">Beige</TextBlock>
<TextBlock Grid.Row="7" Grid.Column="2">#FFF5F5DC</TextBlock>
<Rectangle Grid.Row="8" Grid.Column="0" Width="30" Height="14" Fill="Bisque" />
<TextBlock Grid.Row="8" Grid.Column="1">Bisque</TextBlock>
<TextBlock Grid.Row="8" Grid.Column="2">#FFFFE4C4</TextBlock>
<Rectangle Grid.Row="9" Grid.Column="0" Width="30" Height="14" Fill="Black" />
<TextBlock Grid.Row="9" Grid.Column="1">Black</TextBlock>
<TextBlock Grid.Row="9" Grid.Column="2">#FF000000</TextBlock>
<Rectangle Grid.Row="10" Grid.Column="0" Width="30" Height="14" Fill="BlanchedAlmond" />
<TextBlock Grid.Row="10" Grid.Column="1">BlanchedAlmond</TextBlock>
<TextBlock Grid.Row="10" Grid.Column="2">#FFFFEBCD</TextBlock>
<Rectangle Grid.Row="11" Grid.Column="0" Width="30" Height="14" Fill="Blue" />
<TextBlock Grid.Row="11" Grid.Column="1">Blue</TextBlock>
<TextBlock Grid.Row="11" Grid.Column="2">#FF0000FF</TextBlock>
<Rectangle Grid.Row="12" Grid.Column="0" Width="30" Height="14" Fill="BlueViolet" />
<TextBlock Grid.Row="12" Grid.Column="1">BlueViolet</TextBlock>
<TextBlock Grid.Row="12" Grid.Column="2">#FF8A2BE2</TextBlock>
<Rectangle Grid.Row="13" Grid.Column="0" Width="30" Height="14" Fill="Brown" />
<TextBlock Grid.Row="13" Grid.Column="1">Brown</TextBlock>
<TextBlock Grid.Row="13" Grid.Column="2">#FFA52A2A</TextBlock>
<Rectangle Grid.Row="14" Grid.Column="0" Width="30" Height="14" Fill="BurlyWood" />
<TextBlock Grid.Row="14" Grid.Column="1">BurlyWood</TextBlock>
<TextBlock Grid.Row="14" Grid.Column="2">#FFDEB887</TextBlock>
<Rectangle Grid.Row="15" Grid.Column="0" Width="30" Height="14" Fill="CadetBlue" />
<TextBlock Grid.Row="15" Grid.Column="1">CadetBlue</TextBlock>
<TextBlock Grid.Row="15" Grid.Column="2">#FF5F9EA0</TextBlock>
<Rectangle Grid.Row="16" Grid.Column="0" Width="30" Height="14" Fill="Chartreuse" />
<TextBlock Grid.Row="16" Grid.Column="1">Chartreuse</TextBlock>
<TextBlock Grid.Row="16" Grid.Column="2">#FF7FFF00</TextBlock>
<Rectangle Grid.Row="17" Grid.Column="0" Width="30" Height="14" Fill="Chocolate" />
<TextBlock Grid.Row="17" Grid.Column="1">Chocolate</TextBlock>
<TextBlock Grid.Row="17" Grid.Column="2">#FFD2691E</TextBlock>
<Rectangle Grid.Row="18" Grid.Column="0" Width="30" Height="14" Fill="Coral" />
<TextBlock Grid.Row="18" Grid.Column="1">Coral</TextBlock>
<TextBlock Grid.Row="18" Grid.Column="2">#FFFF7F50</TextBlock>
<Rectangle Grid.Row="19" Grid.Column="0" Width="30" Height="14" Fill="CornflowerBlue" />
<TextBlock Grid.Row="19" Grid.Column="1">CornflowerBlue</TextBlock>
<TextBlock Grid.Row="19" Grid.Column="2">#FF6495ED</TextBlock>
<Rectangle Grid.Row="20" Grid.Column="0" Width="30" Height="14" Fill="Cornsilk" />
<TextBlock Grid.Row="20" Grid.Column="1">Cornsilk</TextBlock>
<TextBlock Grid.Row="20" Grid.Column="2">#FFFFF8DC</TextBlock>
<Rectangle Grid.Row="21" Grid.Column="0" Width="30" Height="14" Fill="Crimson" />
<TextBlock Grid.Row="21" Grid.Column="1">Crimson</TextBlock>
<TextBlock Grid.Row="21" Grid.Column="2">#FFDC143C</TextBlock>
<Rectangle Grid.Row="22" Grid.Column="0" Width="30" Height="14" Fill="Cyan" />
<TextBlock Grid.Row="22" Grid.Column="1">Cyan</TextBlock>
<TextBlock Grid.Row="22" Grid.Column="2">#FF00FFFF</TextBlock>
<Rectangle Grid.Row="23" Grid.Column="0" Width="30" Height="14" Fill="DarkBlue" />
<TextBlock Grid.Row="23" Grid.Column="1">DarkBlue</TextBlock>
<TextBlock Grid.Row="23" Grid.Column="2">#FF00008B</TextBlock>
<Rectangle Grid.Row="24" Grid.Column="0" Width="30" Height="14" Fill="DarkCyan" />
<TextBlock Grid.Row="24" Grid.Column="1">DarkCyan</TextBlock>
<TextBlock Grid.Row="24" Grid.Column="2">#FF008B8B</TextBlock>
<Rectangle Grid.Row="25" Grid.Column="0" Width="30" Height="14" Fill="DarkGoldenrod" />
<TextBlock Grid.Row="25" Grid.Column="1">DarkGoldenrod</TextBlock>
<TextBlock Grid.Row="25" Grid.Column="2">#FFB8860B</TextBlock>
<Rectangle Grid.Row="26" Grid.Column="0" Width="30" Height="14" Fill="DarkGray" />
<TextBlock Grid.Row="26" Grid.Column="1">DarkGray</TextBlock>
<TextBlock Grid.Row="26" Grid.Column="2">#FFA9A9A9</TextBlock>
<Rectangle Grid.Row="27" Grid.Column="0" Width="30" Height="14" Fill="DarkGreen" />
<TextBlock Grid.Row="27" Grid.Column="1">DarkGreen</TextBlock>
<TextBlock Grid.Row="27" Grid.Column="2">#FF006400</TextBlock>
<Rectangle Grid.Row="28" Grid.Column="0" Width="30" Height="14" Fill="DarkKhaki" />
<TextBlock Grid.Row="28" Grid.Column="1">DarkKhaki</TextBlock>
<TextBlock Grid.Row="28" Grid.Column="2">#FFBDB76B</TextBlock>
<Rectangle Grid.Row="29" Grid.Column="0" Width="30" Height="14" Fill="DarkMagenta" />
<TextBlock Grid.Row="29" Grid.Column="1">DarkMagenta</TextBlock>
<TextBlock Grid.Row="29" Grid.Column="2">#FF8B008B</TextBlock>
<Rectangle Grid.Row="30" Grid.Column="0" Width="30" Height="14" Fill="DarkOliveGreen" />
<TextBlock Grid.Row="30" Grid.Column="1">DarkOliveGreen</TextBlock>
<TextBlock Grid.Row="30" Grid.Column="2">#FF556B2F</TextBlock>
<Rectangle Grid.Row="31" Grid.Column="0" Width="30" Height="14" Fill="DarkOrange" />
<TextBlock Grid.Row="31" Grid.Column="1">DarkOrange</TextBlock>
<TextBlock Grid.Row="31" Grid.Column="2">#FFFF8C00</TextBlock>
<Rectangle Grid.Row="32" Grid.Column="0" Width="30" Height="14" Fill="DarkOrchid" />
<TextBlock Grid.Row="32" Grid.Column="1">DarkOrchid</TextBlock>
<TextBlock Grid.Row="32" Grid.Column="2">#FF9932CC</TextBlock>
<Rectangle Grid.Row="33" Grid.Column="0" Width="30" Height="14" Fill="DarkRed" />
<TextBlock Grid.Row="33" Grid.Column="1">DarkRed</TextBlock>
<TextBlock Grid.Row="33" Grid.Column="2">#FF8B0000</TextBlock>
<Rectangle Grid.Row="34" Grid.Column="0" Width="30" Height="14" Fill="DarkSalmon" />
<TextBlock Grid.Row="34" Grid.Column="1">DarkSalmon</TextBlock>
<TextBlock Grid.Row="34" Grid.Column="2">#FFE9967A</TextBlock>
<Rectangle Grid.Row="35" Grid.Column="0" Width="30" Height="14" Fill="DarkSeaGreen" />
<TextBlock Grid.Row="35" Grid.Column="1">DarkSeaGreen</TextBlock>
<TextBlock Grid.Row="35" Grid.Column="2">#FF8FBC8F</TextBlock>
<Rectangle Grid.Row="36" Grid.Column="0" Width="30" Height="14" Fill="DarkSlateBlue" />
<TextBlock Grid.Row="36" Grid.Column="1">DarkSlateBlue</TextBlock>
<TextBlock Grid.Row="36" Grid.Column="2">#FF483D8B</TextBlock>
<Rectangle Grid.Row="37" Grid.Column="0" Width="30" Height="14" Fill="DarkSlateGray" />
<TextBlock Grid.Row="37" Grid.Column="1">DarkSlateGray</TextBlock>
<TextBlock Grid.Row="37" Grid.Column="2">#FF2F4F4F</TextBlock>
<Rectangle Grid.Row="2" Grid.Column="3" Width="30" Height="14" Fill="DarkTurquoise" />
<TextBlock Grid.Row="2" Grid.Column="4">DarkTurquoise</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="5">#FF00CED1</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="3" Width="30" Height="14" Fill="DarkViolet" />
<TextBlock Grid.Row="3" Grid.Column="4">DarkViolet</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="5">#FF9400D3</TextBlock>
<Rectangle Grid.Row="4" Grid.Column="3" Width="30" Height="14" Fill="DeepPink" />
<TextBlock Grid.Row="4" Grid.Column="4">DeepPink</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="5">#FFFF1493</TextBlock>
<Rectangle Grid.Row="5" Grid.Column="3" Width="30" Height="14" Fill="DeepSkyBlue" />
<TextBlock Grid.Row="5" Grid.Column="4">DeepSkyBlue</TextBlock>
<TextBlock Grid.Row="5" Grid.Column="5">#FF00BFFF</TextBlock>
<Rectangle Grid.Row="6" Grid.Column="3" Width="30" Height="14" Fill="DimGray" />
<TextBlock Grid.Row="6" Grid.Column="4">DimGray</TextBlock>
<TextBlock Grid.Row="6" Grid.Column="5">#FF696969</TextBlock>
<Rectangle Grid.Row="7" Grid.Column="3" Width="30" Height="14" Fill="DodgerBlue" />
<TextBlock Grid.Row="7" Grid.Column="4">DodgerBlue</TextBlock>
<TextBlock Grid.Row="7" Grid.Column="5">#FF1E90FF</TextBlock>
<Rectangle Grid.Row="8" Grid.Column="3" Width="30" Height="14" Fill="Firebrick" />
<TextBlock Grid.Row="8" Grid.Column="4">Firebrick</TextBlock>
<TextBlock Grid.Row="8" Grid.Column="5">#FFB22222</TextBlock>
<Rectangle Grid.Row="9" Grid.Column="3" Width="30" Height="14" Fill="FloralWhite" />
<TextBlock Grid.Row="9" Grid.Column="4">FloralWhite</TextBlock>
<TextBlock Grid.Row="9" Grid.Column="5">#FFFFFAF0</TextBlock>
<Rectangle Grid.Row="10" Grid.Column="3" Width="30" Height="14" Fill="ForestGreen" />
<TextBlock Grid.Row="10" Grid.Column="4">ForestGreen</TextBlock>
<TextBlock Grid.Row="10" Grid.Column="5">#FF228B22</TextBlock>
<Rectangle Grid.Row="11" Grid.Column="3" Width="30" Height="14" Fill="Fuchsia" />
<TextBlock Grid.Row="11" Grid.Column="4">Fuchsia</TextBlock>
<TextBlock Grid.Row="11" Grid.Column="5">#FFFF00FF</TextBlock>
<Rectangle Grid.Row="12" Grid.Column="3" Width="30" Height="14" Fill="Gainsboro" />
<TextBlock Grid.Row="12" Grid.Column="4">Gainsboro</TextBlock>
<TextBlock Grid.Row="12" Grid.Column="5">#FFDCDCDC</TextBlock>
<Rectangle Grid.Row="13" Grid.Column="3" Width="30" Height="14" Fill="GhostWhite" />
<TextBlock Grid.Row="13" Grid.Column="4">GhostWhite</TextBlock>
<TextBlock Grid.Row="13" Grid.Column="5">#FFF8F8FF</TextBlock>
<Rectangle Grid.Row="14" Grid.Column="3" Width="30" Height="14" Fill="Gold" />
<TextBlock Grid.Row="14" Grid.Column="4">Gold</TextBlock>
<TextBlock Grid.Row="14" Grid.Column="5">#FFFFD700</TextBlock>
<Rectangle Grid.Row="15" Grid.Column="3" Width="30" Height="14" Fill="Goldenrod" />
<TextBlock Grid.Row="15" Grid.Column="4">Goldenrod</TextBlock>
<TextBlock Grid.Row="15" Grid.Column="5">#FFDAA520</TextBlock>
<Rectangle Grid.Row="16" Grid.Column="3" Width="30" Height="14" Fill="Gray" />
<TextBlock Grid.Row="16" Grid.Column="4">Gray</TextBlock>
<TextBlock Grid.Row="16" Grid.Column="5">#FF808080</TextBlock>
<Rectangle Grid.Row="17" Grid.Column="3" Width="30" Height="14" Fill="Green" />
<TextBlock Grid.Row="17" Grid.Column="4">Green</TextBlock>
<TextBlock Grid.Row="17" Grid.Column="5">#FF008000</TextBlock>
<Rectangle Grid.Row="18" Grid.Column="3" Width="30" Height="14" Fill="GreenYellow" />
<TextBlock Grid.Row="18" Grid.Column="4">GreenYellow</TextBlock>
<TextBlock Grid.Row="18" Grid.Column="5">#FFADFF2F</TextBlock>
<Rectangle Grid.Row="19" Grid.Column="3" Width="30" Height="14" Fill="Honeydew" />
<TextBlock Grid.Row="19" Grid.Column="4">Honeydew</TextBlock>
<TextBlock Grid.Row="19" Grid.Column="5">#FFF0FFF0</TextBlock>
<Rectangle Grid.Row="20" Grid.Column="3" Width="30" Height="14" Fill="HotPink" />
<TextBlock Grid.Row="20" Grid.Column="4">HotPink</TextBlock>
<TextBlock Grid.Row="20" Grid.Column="5">#FFFF69B4</TextBlock>
<Rectangle Grid.Row="21" Grid.Column="3" Width="30" Height="14" Fill="IndianRed" />
<TextBlock Grid.Row="21" Grid.Column="4">IndianRed</TextBlock>
<TextBlock Grid.Row="21" Grid.Column="5">#FFCD5C5C</TextBlock>
<Rectangle Grid.Row="22" Grid.Column="3" Width="30" Height="14" Fill="Indigo" />
<TextBlock Grid.Row="22" Grid.Column="4">Indigo</TextBlock>
<TextBlock Grid.Row="22" Grid.Column="5">#FF4B0082</TextBlock>
<Rectangle Grid.Row="23" Grid.Column="3" Width="30" Height="14" Fill="Ivory" />
<TextBlock Grid.Row="23" Grid.Column="4">Ivory</TextBlock>
<TextBlock Grid.Row="23" Grid.Column="5">#FFFFFFF0</TextBlock>
<Rectangle Grid.Row="24" Grid.Column="3" Width="30" Height="14" Fill="Khaki" />
<TextBlock Grid.Row="24" Grid.Column="4">Khaki</TextBlock>
<TextBlock Grid.Row="24" Grid.Column="5">#FFF0E68C</TextBlock>
<Rectangle Grid.Row="25" Grid.Column="3" Width="30" Height="14" Fill="Lavender" />
<TextBlock Grid.Row="25" Grid.Column="4">Lavender</TextBlock>
<TextBlock Grid.Row="25" Grid.Column="5">#FFE6E6FA</TextBlock>
<Rectangle Grid.Row="26" Grid.Column="3" Width="30" Height="14" Fill="LavenderBlush" />
<TextBlock Grid.Row="26" Grid.Column="4">LavenderBlush</TextBlock>
<TextBlock Grid.Row="26" Grid.Column="5">#FFFFF0F5</TextBlock>
<Rectangle Grid.Row="27" Grid.Column="3" Width="30" Height="14" Fill="LawnGreen" />
<TextBlock Grid.Row="27" Grid.Column="4">LawnGreen</TextBlock>
<TextBlock Grid.Row="27" Grid.Column="5">#FF7CFC00</TextBlock>
<Rectangle Grid.Row="28" Grid.Column="3" Width="30" Height="14" Fill="LemonChiffon" />
<TextBlock Grid.Row="28" Grid.Column="4">LemonChiffon</TextBlock>
<TextBlock Grid.Row="28" Grid.Column="5">#FFFFFACD</TextBlock>
<Rectangle Grid.Row="29" Grid.Column="3" Width="30" Height="14" Fill="LightBlue" />
<TextBlock Grid.Row="29" Grid.Column="4">LightBlue</TextBlock>
<TextBlock Grid.Row="29" Grid.Column="5">#FFADD8E6</TextBlock>
<Rectangle Grid.Row="30" Grid.Column="3" Width="30" Height="14" Fill="LightCoral" />
<TextBlock Grid.Row="30" Grid.Column="4">LightCoral</TextBlock>
<TextBlock Grid.Row="30" Grid.Column="5">#FFF08080</TextBlock>
<Rectangle Grid.Row="31" Grid.Column="3" Width="30" Height="14" Fill="LightCyan" />
<TextBlock Grid.Row="31" Grid.Column="4">LightCyan</TextBlock>
<TextBlock Grid.Row="31" Grid.Column="5">#FFE0FFFF</TextBlock>
<Rectangle Grid.Row="32" Grid.Column="3" Width="30" Height="14" Fill="LightGoldenrodYellow" />
<TextBlock Grid.Row="32" Grid.Column="4">LightGoldenrodYellow</TextBlock>
<TextBlock Grid.Row="32" Grid.Column="5">#FFFAFAD2</TextBlock>
<Rectangle Grid.Row="33" Grid.Column="3" Width="30" Height="14" Fill="LightGray" />
<TextBlock Grid.Row="33" Grid.Column="4">LightGray</TextBlock>
<TextBlock Grid.Row="33" Grid.Column="5">#FFD3D3D3</TextBlock>
<Rectangle Grid.Row="34" Grid.Column="3" Width="30" Height="14" Fill="LightGreen" />
<TextBlock Grid.Row="34" Grid.Column="4">LightGreen</TextBlock>
<TextBlock Grid.Row="34" Grid.Column="5">#FF90EE90</TextBlock>
<Rectangle Grid.Row="35" Grid.Column="3" Width="30" Height="14" Fill="LightPink" />
<TextBlock Grid.Row="35" Grid.Column="4">LightPink</TextBlock>
<TextBlock Grid.Row="35" Grid.Column="5">#FFFFB6C1</TextBlock>
<Rectangle Grid.Row="36" Grid.Column="3" Width="30" Height="14" Fill="LightSalmon" />
<TextBlock Grid.Row="36" Grid.Column="4">LightSalmon</TextBlock>
<TextBlock Grid.Row="36" Grid.Column="5">#FFFFA07A</TextBlock>
<Rectangle Grid.Row="2" Grid.Column="6" Width="30" Height="14" Fill="LightSeaGreen" />
<TextBlock Grid.Row="2" Grid.Column="7">LightSeaGreen</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="8">#FF20B2AA</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="6" Width="30" Height="14" Fill="LightSkyBlue" />
<TextBlock Grid.Row="3" Grid.Column="7">LightSkyBlue</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="8">#FF87CEFA</TextBlock>
<Rectangle Grid.Row="4" Grid.Column="6" Width="30" Height="14" Fill="LightSlateGray" />
<TextBlock Grid.Row="4" Grid.Column="7">LightSlateGray</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="8">#FF778899</TextBlock>
<Rectangle Grid.Row="5" Grid.Column="6" Width="30" Height="14" Fill="LightSteelBlue" />
<TextBlock Grid.Row="5" Grid.Column="7">LightSteelBlue</TextBlock>
<TextBlock Grid.Row="5" Grid.Column="8">#FFB0C4DE</TextBlock>
<Rectangle Grid.Row="6" Grid.Column="6" Width="30" Height="14" Fill="LightYellow" />
<TextBlock Grid.Row="6" Grid.Column="7">LightYellow</TextBlock>
<TextBlock Grid.Row="6" Grid.Column="8">#FFFFFFE0</TextBlock>
<Rectangle Grid.Row="7" Grid.Column="6" Width="30" Height="14" Fill="Lime" />
<TextBlock Grid.Row="7" Grid.Column="7">Lime</TextBlock>
<TextBlock Grid.Row="7" Grid.Column="8">#FF00FF00</TextBlock>
<Rectangle Grid.Row="8" Grid.Column="6" Width="30" Height="14" Fill="LimeGreen" />
<TextBlock Grid.Row="8" Grid.Column="7">LimeGreen</TextBlock>
<TextBlock Grid.Row="8" Grid.Column="8">#FF32CD32</TextBlock>
<Rectangle Grid.Row="9" Grid.Column="6" Width="30" Height="14" Fill="Linen" />
<TextBlock Grid.Row="9" Grid.Column="7">Linen</TextBlock>
<TextBlock Grid.Row="9" Grid.Column="8">#FFFAF0E6</TextBlock>
<Rectangle Grid.Row="10" Grid.Column="6" Width="30" Height="14" Fill="Magenta" />
<TextBlock Grid.Row="10" Grid.Column="7">Magenta</TextBlock>
<TextBlock Grid.Row="10" Grid.Column="8">#FFFF00FF</TextBlock>
<Rectangle Grid.Row="11" Grid.Column="6" Width="30" Height="14" Fill="Maroon" />
<TextBlock Grid.Row="11" Grid.Column="7">Maroon</TextBlock>
<TextBlock Grid.Row="11" Grid.Column="8">#FF800000</TextBlock>
<Rectangle Grid.Row="12" Grid.Column="6" Width="30" Height="14" Fill="MediumAquamarine" />
<TextBlock Grid.Row="12" Grid.Column="7">MediumAquamarine</TextBlock>
<TextBlock Grid.Row="12" Grid.Column="8">#FF66CDAA</TextBlock>
<Rectangle Grid.Row="13" Grid.Column="6" Width="30" Height="14" Fill="MediumBlue" />
<TextBlock Grid.Row="13" Grid.Column="7">MediumBlue</TextBlock>
<TextBlock Grid.Row="13" Grid.Column="8">#FF0000CD</TextBlock>
<Rectangle Grid.Row="14" Grid.Column="6" Width="30" Height="14" Fill="MediumOrchid" />
<TextBlock Grid.Row="14" Grid.Column="7">MediumOrchid</TextBlock>
<TextBlock Grid.Row="14" Grid.Column="8">#FFBA55D3</TextBlock>
<Rectangle Grid.Row="15" Grid.Column="6" Width="30" Height="14" Fill="MediumPurple" />
<TextBlock Grid.Row="15" Grid.Column="7">MediumPurple</TextBlock>
<TextBlock Grid.Row="15" Grid.Column="8">#FF9370DB</TextBlock>
<Rectangle Grid.Row="16" Grid.Column="6" Width="30" Height="14" Fill="MediumSeaGreen" />
<TextBlock Grid.Row="16" Grid.Column="7">MediumSeaGreen</TextBlock>
<TextBlock Grid.Row="16" Grid.Column="8">#FF3CB371</TextBlock>
<Rectangle Grid.Row="17" Grid.Column="6" Width="30" Height="14" Fill="MediumSlateBlue" />
<TextBlock Grid.Row="17" Grid.Column="7">MediumSlateBlue</TextBlock>
<TextBlock Grid.Row="17" Grid.Column="8">#FF7B68EE</TextBlock>
<Rectangle Grid.Row="18" Grid.Column="6" Width="30" Height="14" Fill="MediumSpringGreen" />
<TextBlock Grid.Row="18" Grid.Column="7">MediumSpringGreen</TextBlock>
<TextBlock Grid.Row="18" Grid.Column="8">#FF00FA9A</TextBlock>
<Rectangle Grid.Row="19" Grid.Column="6" Width="30" Height="14" Fill="MediumTurquoise" />
<TextBlock Grid.Row="19" Grid.Column="7">MediumTurquoise</TextBlock>
<TextBlock Grid.Row="19" Grid.Column="8">#FF48D1CC</TextBlock>
<Rectangle Grid.Row="20" Grid.Column="6" Width="30" Height="14" Fill="MediumVioletRed" />
<TextBlock Grid.Row="20" Grid.Column="7">MediumVioletRed</TextBlock>
<TextBlock Grid.Row="20" Grid.Column="8">#FFC71585</TextBlock>
<Rectangle Grid.Row="21" Grid.Column="6" Width="30" Height="14" Fill="MidnightBlue" />
<TextBlock Grid.Row="21" Grid.Column="7">MidnightBlue</TextBlock>
<TextBlock Grid.Row="21" Grid.Column="8">#FF191970</TextBlock>
<Rectangle Grid.Row="22" Grid.Column="6" Width="30" Height="14" Fill="MintCream" />
<TextBlock Grid.Row="22" Grid.Column="7">MintCream</TextBlock>
<TextBlock Grid.Row="22" Grid.Column="8">#FFF5FFFA</TextBlock>
<Rectangle Grid.Row="23" Grid.Column="6" Width="30" Height="14" Fill="MistyRose" />
<TextBlock Grid.Row="23" Grid.Column="7">MistyRose</TextBlock>
<TextBlock Grid.Row="23" Grid.Column="8">#FFFFE4E1</TextBlock>
<Rectangle Grid.Row="24" Grid.Column="6" Width="30" Height="14" Fill="Moccasin" />
<TextBlock Grid.Row="24" Grid.Column="7">Moccasin</TextBlock>
<TextBlock Grid.Row="24" Grid.Column="8">#FFFFE4B5</TextBlock>
<Rectangle Grid.Row="25" Grid.Column="6" Width="30" Height="14" Fill="NavajoWhite" />
<TextBlock Grid.Row="25" Grid.Column="7">NavajoWhite</TextBlock>
<TextBlock Grid.Row="25" Grid.Column="8">#FFFFDEAD</TextBlock>
<Rectangle Grid.Row="26" Grid.Column="6" Width="30" Height="14" Fill="Navy" />
<TextBlock Grid.Row="26" Grid.Column="7">Navy</TextBlock>
<TextBlock Grid.Row="26" Grid.Column="8">#FF000080</TextBlock>
<Rectangle Grid.Row="27" Grid.Column="6" Width="30" Height="14" Fill="OldLace" />
<TextBlock Grid.Row="27" Grid.Column="7">OldLace</TextBlock>
<TextBlock Grid.Row="27" Grid.Column="8">#FFFDF5E6</TextBlock>
<Rectangle Grid.Row="28" Grid.Column="6" Width="30" Height="14" Fill="Olive" />
<TextBlock Grid.Row="28" Grid.Column="7">Olive</TextBlock>
<TextBlock Grid.Row="28" Grid.Column="8">#FF808000</TextBlock>
<Rectangle Grid.Row="29" Grid.Column="6" Width="30" Height="14" Fill="OliveDrab" />
<TextBlock Grid.Row="29" Grid.Column="7">OliveDrab</TextBlock>
<TextBlock Grid.Row="29" Grid.Column="8">#FF6B8E23</TextBlock>
<Rectangle Grid.Row="30" Grid.Column="6" Width="30" Height="14" Fill="Orange" />
<TextBlock Grid.Row="30" Grid.Column="7">Orange</TextBlock>
<TextBlock Grid.Row="30" Grid.Column="8">#FFFFA500</TextBlock>
<Rectangle Grid.Row="31" Grid.Column="6" Width="30" Height="14" Fill="OrangeRed" />
<TextBlock Grid.Row="31" Grid.Column="7">OrangeRed</TextBlock>
<TextBlock Grid.Row="31" Grid.Column="8">#FFFF4500</TextBlock>
<Rectangle Grid.Row="32" Grid.Column="6" Width="30" Height="14" Fill="Orchid" />
<TextBlock Grid.Row="32" Grid.Column="7">Orchid</TextBlock>
<TextBlock Grid.Row="32" Grid.Column="8">#FFDA70D6</TextBlock>
<Rectangle Grid.Row="33" Grid.Column="6" Width="30" Height="14" Fill="PaleGoldenrod" />
<TextBlock Grid.Row="33" Grid.Column="7">PaleGoldenrod</TextBlock>
<TextBlock Grid.Row="33" Grid.Column="8">#FFEEE8AA</TextBlock>
<Rectangle Grid.Row="34" Grid.Column="6" Width="30" Height="14" Fill="PaleGreen" />
<TextBlock Grid.Row="34" Grid.Column="7">PaleGreen</TextBlock>
<TextBlock Grid.Row="34" Grid.Column="8">#FF98FB98</TextBlock>
<Rectangle Grid.Row="35" Grid.Column="6" Width="30" Height="14" Fill="PaleTurquoise" />
<TextBlock Grid.Row="35" Grid.Column="7">PaleTurquoise</TextBlock>
<TextBlock Grid.Row="35" Grid.Column="8">#FFAFEEEE</TextBlock>
<Rectangle Grid.Row="36" Grid.Column="6" Width="30" Height="14" Fill="PaleVioletRed" />
<TextBlock Grid.Row="36" Grid.Column="7">PaleVioletRed</TextBlock>
<TextBlock Grid.Row="36" Grid.Column="8">#FFDB7093</TextBlock>
<Rectangle Grid.Row="2" Grid.Column="9" Width="30" Height="14" Fill="PapayaWhip" />
<TextBlock Grid.Row="2" Grid.Column="10">PapayaWhip</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="11">#FFFFEFD5</TextBlock>
<Rectangle Grid.Row="3" Grid.Column="9" Width="30" Height="14" Fill="PeachPuff" />
<TextBlock Grid.Row="3" Grid.Column="10">PeachPuff</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="11">#FFFFDAB9</TextBlock>
<Rectangle Grid.Row="4" Grid.Column="9" Width="30" Height="14" Fill="Peru" />
<TextBlock Grid.Row="4" Grid.Column="10">Peru</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="11">#FFCD853F</TextBlock>
<Rectangle Grid.Row="5" Grid.Column="9" Width="30" Height="14" Fill="Pink" />
<TextBlock Grid.Row="5" Grid.Column="10">Pink</TextBlock>
<TextBlock Grid.Row="5" Grid.Column="11">#FFFFC0CB</TextBlock>
<Rectangle Grid.Row="6" Grid.Column="9" Width="30" Height="14" Fill="Plum" />
<TextBlock Grid.Row="6" Grid.Column="10">Plum</TextBlock>
<TextBlock Grid.Row="6" Grid.Column="11">#FFDDA0DD</TextBlock>
<Rectangle Grid.Row="7" Grid.Column="9" Width="30" Height="14" Fill="PowderBlue" />
<TextBlock Grid.Row="7" Grid.Column="10">PowderBlue</TextBlock>
<TextBlock Grid.Row="7" Grid.Column="11">#FFB0E0E6</TextBlock>
<Rectangle Grid.Row="8" Grid.Column="9" Width="30" Height="14" Fill="Purple" />
<TextBlock Grid.Row="8" Grid.Column="10">Purple</TextBlock>
<TextBlock Grid.Row="8" Grid.Column="11">#FF800080</TextBlock>
<Rectangle Grid.Row="9" Grid.Column="9" Width="30" Height="14" Fill="Red" />
<TextBlock Grid.Row="9" Grid.Column="10">Red</TextBlock>
<TextBlock Grid.Row="9" Grid.Column="11">#FFFF0000</TextBlock>
<Rectangle Grid.Row="10" Grid.Column="9" Width="30" Height="14" Fill="RosyBrown" />
<TextBlock Grid.Row="10" Grid.Column="10">RosyBrown</TextBlock>
<TextBlock Grid.Row="10" Grid.Column="11">#FFBC8F8F</TextBlock>
<Rectangle Grid.Row="11" Grid.Column="9" Width="30" Height="14" Fill="RoyalBlue" />
<TextBlock Grid.Row="11" Grid.Column="10">RoyalBlue</TextBlock>
<TextBlock Grid.Row="11" Grid.Column="11">#FF4169E1</TextBlock>
<Rectangle Grid.Row="12" Grid.Column="9" Width="30" Height="14" Fill="SaddleBrown" />
<TextBlock Grid.Row="12" Grid.Column="10">SaddleBrown</TextBlock>
<TextBlock Grid.Row="12" Grid.Column="11">#FF8B4513</TextBlock>
<Rectangle Grid.Row="13" Grid.Column="9" Width="30" Height="14" Fill="Salmon" />
<TextBlock Grid.Row="13" Grid.Column="10">Salmon</TextBlock>
<TextBlock Grid.Row="13" Grid.Column="11">#FFFA8072</TextBlock>
<Rectangle Grid.Row="14" Grid.Column="9" Width="30" Height="14" Fill="SandyBrown" />
<TextBlock Grid.Row="14" Grid.Column="10">SandyBrown</TextBlock>
<TextBlock Grid.Row="14" Grid.Column="11">#FFF4A460</TextBlock>
<Rectangle Grid.Row="15" Grid.Column="9" Width="30" Height="14" Fill="SeaGreen" />
<TextBlock Grid.Row="15" Grid.Column="10">SeaGreen</TextBlock>
<TextBlock Grid.Row="15" Grid.Column="11">#FF2E8B57</TextBlock>
<Rectangle Grid.Row="16" Grid.Column="9" Width="30" Height="14" Fill="SeaShell" />
<TextBlock Grid.Row="16" Grid.Column="10">SeaShell</TextBlock>
<TextBlock Grid.Row="16" Grid.Column="11">#FFFFF5EE</TextBlock>
<Rectangle Grid.Row="17" Grid.Column="9" Width="30" Height="14" Fill="Sienna" />
<TextBlock Grid.Row="17" Grid.Column="10">Sienna</TextBlock>
<TextBlock Grid.Row="17" Grid.Column="11">#FFA0522D</TextBlock>
<Rectangle Grid.Row="18" Grid.Column="9" Width="30" Height="14" Fill="Silver" />
<TextBlock Grid.Row="18" Grid.Column="10">Silver</TextBlock>
<TextBlock Grid.Row="18" Grid.Column="11">#FFC0C0C0</TextBlock>
<Rectangle Grid.Row="19" Grid.Column="9" Width="30" Height="14" Fill="SkyBlue" />
<TextBlock Grid.Row="19" Grid.Column="10">SkyBlue</TextBlock>
<TextBlock Grid.Row="19" Grid.Column="11">#FF87CEEB</TextBlock>
<Rectangle Grid.Row="20" Grid.Column="9" Width="30" Height="14" Fill="SlateBlue" />
<TextBlock Grid.Row="20" Grid.Column="10">SlateBlue</TextBlock>
<TextBlock Grid.Row="20" Grid.Column="11">#FF6A5ACD</TextBlock>
<Rectangle Grid.Row="21" Grid.Column="9" Width="30" Height="14" Fill="SlateGray" />
<TextBlock Grid.Row="21" Grid.Column="10">SlateGray</TextBlock>
<TextBlock Grid.Row="21" Grid.Column="11">#FF708090</TextBlock>
<Rectangle Grid.Row="22" Grid.Column="9" Width="30" Height="14" Fill="Snow" />
<TextBlock Grid.Row="22" Grid.Column="10">Snow</TextBlock>
<TextBlock Grid.Row="22" Grid.Column="11">#FFFFFAFA</TextBlock>
<Rectangle Grid.Row="23" Grid.Column="9" Width="30" Height="14" Fill="SpringGreen" />
<TextBlock Grid.Row="23" Grid.Column="10">SpringGreen</TextBlock>
<TextBlock Grid.Row="23" Grid.Column="11">#FF00FF7F</TextBlock>
<Rectangle Grid.Row="24" Grid.Column="9" Width="30" Height="14" Fill="SteelBlue" />
<TextBlock Grid.Row="24" Grid.Column="10">SteelBlue</TextBlock>
<TextBlock Grid.Row="24" Grid.Column="11">#FF4682B4</TextBlock>
<Rectangle Grid.Row="25" Grid.Column="9" Width="30" Height="14" Fill="Tan" />
<TextBlock Grid.Row="25" Grid.Column="10">Tan</TextBlock>
<TextBlock Grid.Row="25" Grid.Column="11">#FFD2B48C</TextBlock>
<Rectangle Grid.Row="26" Grid.Column="9" Width="30" Height="14" Fill="Teal" />
<TextBlock Grid.Row="26" Grid.Column="10">Teal</TextBlock>
<TextBlock Grid.Row="26" Grid.Column="11">#FF008080</TextBlock>
<Rectangle Grid.Row="27" Grid.Column="9" Width="30" Height="14" Fill="Thistle" />
<TextBlock Grid.Row="27" Grid.Column="10">Thistle</TextBlock>
<TextBlock Grid.Row="27" Grid.Column="11">#FFD8BFD8</TextBlock>
<Rectangle Grid.Row="28" Grid.Column="9" Width="30" Height="14" Fill="Tomato" />
<TextBlock Grid.Row="28" Grid.Column="10">Tomato</TextBlock>
<TextBlock Grid.Row="28" Grid.Column="11">#FFFF6347</TextBlock>
<Rectangle Grid.Row="29" Grid.Column="9" Width="30" Height="14" Fill="Transparent" />
<TextBlock Grid.Row="29" Grid.Column="10">Transparent</TextBlock>
<TextBlock Grid.Row="29" Grid.Column="11">#00FFFFFF</TextBlock>
<Rectangle Grid.Row="30" Grid.Column="9" Width="30" Height="14" Fill="Turquoise" />
<TextBlock Grid.Row="30" Grid.Column="10">Turquoise</TextBlock>
<TextBlock Grid.Row="30" Grid.Column="11">#FF40E0D0</TextBlock>
<Rectangle Grid.Row="31" Grid.Column="9" Width="30" Height="14" Fill="Violet" />
<TextBlock Grid.Row="31" Grid.Column="10">Violet</TextBlock>
<TextBlock Grid.Row="31" Grid.Column="11">#FFEE82EE</TextBlock>
<Rectangle Grid.Row="32" Grid.Column="9" Width="30" Height="14" Fill="Wheat" />
<TextBlock Grid.Row="32" Grid.Column="10">Wheat</TextBlock>
<TextBlock Grid.Row="32" Grid.Column="11">#FFF5DEB3</TextBlock>
<Rectangle Grid.Row="33" Grid.Column="9" Width="30" Height="14" Fill="White" />
<TextBlock Grid.Row="33" Grid.Column="10">White</TextBlock>
<TextBlock Grid.Row="33" Grid.Column="11">#FFFFFFFF</TextBlock>
<Rectangle Grid.Row="34" Grid.Column="9" Width="30" Height="14" Fill="WhiteSmoke" />
<TextBlock Grid.Row="34" Grid.Column="10">WhiteSmoke</TextBlock>
<TextBlock Grid.Row="34" Grid.Column="11">#FFF5F5F5</TextBlock>
<Rectangle Grid.Row="35" Grid.Column="9" Width="30" Height="14" Fill="Yellow" />
<TextBlock Grid.Row="35" Grid.Column="10">Yellow</TextBlock>
<TextBlock Grid.Row="35" Grid.Column="11">#FFFFFF00</TextBlock>
<Rectangle Grid.Row="36" Grid.Column="9" Width="30" Height="14" Fill="YellowGreen" />
<TextBlock Grid.Row="36" Grid.Column="10">YellowGreen</TextBlock>
<TextBlock Grid.Row="36" Grid.Column="11">#FF9ACD32</TextBlock>
</Grid>
</Page>
@@ -0,0 +1,236 @@
<!-- RadialGradientBrushAnimationExample.xaml
This example shows several different ways of animating
GradientBrushes. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="RadialGradientBrush Animation Example">
<Page.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Background" Value="White" />
<Setter Property="Padding" Value="10" />
<Setter Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="White" />
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="BitmapEffect">
<Setter.Value>
<DropShadowBitmapEffect />
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<DockPanel>
<!-- Header -->
<Border Margin="10"
Background="{StaticResource blueHorizontalGradientBrush}"
DockPanel.Dock="Top">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
The following examples show several different ways of animating gradient brushes.
Left-click the shapes to begin their animations.
</TextBlock>
</Border>
<!-- Footer -->
<Rectangle Margin="10"
DockPanel.Dock="Bottom"
Style="{StaticResource footerRectangleStyle}"
Fill="{StaticResource blueHorizontalGradientBrush}" />
<StackPanel Orientation="Horizontal">
<StackPanel Margin="10" Background="{StaticResource checkeredBackground}">
<!-- GradientStop Property Animation Samples -->
<TextBlock>Animated GradientStop Offset</TextBlock>
<!-- <SnippetGraphicsMMRadialGradientOffsetAnimationInline> -->
<Rectangle Name="animatedGradientStopOffsetExampleRectangle"
Width="200" Height="100"
Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<RadialGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="gradientStopA2" Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="gradientStopA2"
Storyboard.TargetProperty="Offset"
From="0.0" To="1.0" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<!-- </SnippetGraphicsMMRadialGradientOffsetAnimationInline> -->
<TextBlock>Animated GradientStop Color</TextBlock>
<!-- <SnippetGraphicsMMRadialGradientColorAnimationInline> -->
<Rectangle Name="animatedGradientStopColorExampleRectangle"
Width="200" Height="100"
Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<RadialGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="gradientStopB2" Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="gradientStopB2"
Storyboard.TargetProperty="Color"
From="Purple" To="Yellow" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
<!-- </SnippetGraphicsMMRadialGradientColorAnimationInline> -->
<TextBlock>Animated GradientStop Opacity</TextBlock>
<Rectangle Name="animatedGradientStopOpacityExampleRectangle"
Width="200" Height="100"
Stroke="Black" StrokeThickness="1"
Margin="10">
<Rectangle.Fill>
<RadialGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0" />
<GradientStop x:Name="gradientStopC2" Color="Purple" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="gradientStopC2"
Storyboard.TargetProperty="Color"
Duration="0:0:3" FillBehavior="Stop">
<ColorAnimation.By>
<Color ScA="-1" ScR="0" ScB="0" ScG="0" />
</ColorAnimation.By>
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</StackPanel>
<StackPanel Margin="10" Background="{StaticResource checkeredBackground}">
<!-- RadialGradientBrush Property Animation Samples -->
<TextBlock>Animated GradientOrigin</TextBlock>
<Ellipse
Width="200" Height="100"
Stroke="Black" StrokeThickness="1"
Margin="10">
<Ellipse.Fill>
<RadialGradientBrush x:Name="animatedGradientOriginExample"
GradientOrigin="0.75,0.25">
<GradientStop Color="#CBC8F1" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="DarkBlue" Offset="1.0" />
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.Triggers>
<EventTrigger RoutedEvent="Ellipse.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<PointAnimation
Storyboard.TargetName="animatedGradientOriginExample"
Storyboard.TargetProperty="GradientOrigin"
From="1,0" To="0,1" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
<TextBlock>Animated Center</TextBlock>
<Ellipse
Width="200" Height="100"
Stroke="Black" StrokeThickness="1"
Margin="10">
<Ellipse.Fill>
<RadialGradientBrush x:Name="animatedCenterExample"
GradientOrigin="0.75,0.25">
<GradientStop Color="#CBC8F1" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="DarkBlue" Offset="1.0" />
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.Triggers>
<EventTrigger RoutedEvent="Ellipse.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<PointAnimation
Storyboard.TargetName="animatedCenterExample"
Storyboard.TargetProperty="Center"
From="0,0" To="1,1" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
<TextBlock>Animated Radius</TextBlock>
<Ellipse
Width="200" Height="100" Stroke="Black" StrokeThickness="1"
Margin="10">
<Ellipse.Fill>
<RadialGradientBrush x:Name="animatedRadiusExample"
GradientOrigin="0.75,0.25">
<GradientStop Color="#CBC8F1" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="DarkBlue" Offset="1.0" />
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.Triggers>
<EventTrigger RoutedEvent="Ellipse.MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="animatedRadiusExample"
Storyboard.TargetProperty="RadiusX"
From="0" To="1" Duration="0:0:3" FillBehavior="Stop" />
<DoubleAnimation
Storyboard.TargetName="animatedRadiusExample"
Storyboard.TargetProperty="RadiusY"
From="0" To="1" Duration="0:0:3" FillBehavior="Stop" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
</StackPanel>
</StackPanel>
</DockPanel>
</Page>
@@ -0,0 +1,124 @@
<!-- RadialGradientBrushExample.xaml
This example shows radial gradients with different gradient origin
and center settings. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Radial Gradients">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
Background="{StaticResource blueHorizontalGradientBrush}">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
The following examples show radial gradients with different gradient origin and center settings.
The gradient origin of each radial gradient is marked with a red dot, and the gradient circle
is outlined with a red circle.
</TextBlock>
</Border>
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,10,0">
<Bold>GradientOrigin</Bold>: 0.5,0.5<LineBreak/>
<Bold>Center</Bold>: 0.5,0.5<LineBreak/>
<Bold>RadiusX</Bold>: 0.5<LineBreak/>
<Bold>RadiusY</Bold>: 0.5
</TextBlock>
<Canvas Grid.Row="3" Grid.Column="0" Width="150" Height="150">
<Rectangle Width="150" Height="150">
<Rectangle.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="#545454" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- Highlights the gradient origin and the gradient circle -->
<Path Fill="Red">
<Path.Data>
<EllipseGeometry Center="75,75" RadiusX="2" RadiusY="2" />
</Path.Data>
</Path>
<Path Stroke="Red" StrokeThickness="2">
<Path.Data>
<EllipseGeometry Center="75,75" RadiusX="74" RadiusY="74" />
</Path.Data>
</Path>
</Canvas>
<TextBlock Grid.Row="2" Grid.Column="1" Margin="0,0,10,0">
<Bold>GradientOrigin</Bold>: 0.75,0.25<LineBreak/>
<Bold>Center</Bold>: 0.5,0.5<LineBreak/>
<Bold>RadiusX</Bold>: 0.5<LineBreak/>
<Bold>RadiusY</Bold>: 0.5
</TextBlock>
<Canvas Grid.Row="3" Grid.Column="1" Width="150" Height="150">
<Rectangle Width="150" Height="150">
<Rectangle.Fill>
<RadialGradientBrush GradientOrigin="0.75,0.25" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#545454" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- Highlights the gradient origin and the gradient circle -->
<Path Fill="Red">
<Path.Data>
<EllipseGeometry Center="112.5,37.5" RadiusX="2" RadiusY="2" />
</Path.Data>
</Path>
<Path Stroke="Red" StrokeThickness="2">
<Path.Data>
<EllipseGeometry Center="75,75" RadiusX="74" RadiusY="74" />
</Path.Data>
</Path>
</Canvas>
<TextBlock Grid.Row="2" Grid.Column="2" >
<Bold>GradientOrigin</Bold>: 0.5,0.5<LineBreak/>
<Bold>Center</Bold>: 0.1,0.1<LineBreak/>
<Bold>RadiusX</Bold>: 0.75<LineBreak/>
<Bold>RadiusY</Bold>: 0.75
</TextBlock>
<Canvas ClipToBounds="True" Grid.Row="3" Grid.Column="2" Width="150" Height="150">
<Rectangle Width="150" Height="150">
<Rectangle.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.1,0.1" RadiusX="0.75" RadiusY="0.75">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#545454" Offset="1" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- Highlights the gradient origin and the gradient circle -->
<Path Fill="Red">
<Path.Data>
<EllipseGeometry Center="75,75" RadiusX="2" RadiusY="2" />
</Path.Data>
</Path>
<Path Stroke="Red" StrokeThickness="2">
<Path.Data>
<EllipseGeometry Center="15,15" RadiusX="111.5" RadiusY="111.5" />
</Path.Data>
</Path>
</Canvas>
<Rectangle Style="{StaticResource footerRectangleStyle}"
Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3"
Fill="{StaticResource blueHorizontalGradientBrush}"/>
</Grid>
</Page>
@@ -0,0 +1,27 @@
<!-- <SnippetSimpleRadialGradientExampleWholePage> -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="RadialGradientBrush Example"
Background="White" Margin="20">
<StackPanel>
<!-- This rectangle is painted with a radial gradient. -->
<Rectangle Width="200" Height="100">
<Rectangle.Fill>
<RadialGradientBrush
GradientOrigin="0.5,0.5"
Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Page>
<!-- </SnippetSimpleRadialGradientExampleWholePage> -->
@@ -0,0 +1,57 @@
<!--
SampleViewer.xaml
Provides a UI for navigating through the different brush examples.
-->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="BrushesIntroduction.SampleViewer"
xmlns:examples="clr-namespace:BrushesIntroduction"
WindowTitle="Brush Examples"
Background="White">
<DockPanel Name="mainPanel">
<TabControl>
<TabItem Header="BrushTypes">
<Frame Source="BrushTypesExample.xaml" />
</TabItem>
<TabItem Header="Tile Brushes">
<TabControl>
<TabItem Header="TileModeExample" Background="White">
<Frame Source="TileModeExample.xaml" Background="White" />
</TabItem>
</TabControl>
</TabItem>
<TabItem Header="Brush Properties">
<TabControl>
<TabItem Header="Brush Transform Example" Background="White">
<Frame Source="BrushTransformExample.xaml" Background="White" />
</TabItem>
</TabControl>
</TabItem>
<TabItem Header="Gradient Brushes">
<TabControl>
<TabItem Header="GradientStopAnimationExample">
<Frame Source="GradientStopAnimationExample.xaml" />
</TabItem>
<TabItem Header="RadialGradientBrush Snippet">
<Frame Source="RadialGradientBrushSnippet.xaml" />
</TabItem>
<TabItem Header="GradientSpreadMethod Snippet">
<Frame Source="GradientSpreadExample.xaml" />
</TabItem>
</TabControl>
</TabItem>
</TabControl>
</DockPanel>
</Page>
@@ -0,0 +1,26 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media.Animation;
using System.Reflection;
using System.Xml;
namespace BrushesIntroduction
{
/// <summary>
/// Interaction logic for SampleViewer.xaml
/// </summary>
public partial class SampleViewer : Page
{
public SampleViewer()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,138 @@
<!-- SolidColorBrush.xaml
There are many different ways to paint an area
with a solid color.
The following example demonstrates the different methods of
painting an area with a solid color. Each rectangle is filled
with the color blue, each specified in a different format. -->
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SolidColorBrush Syntax">
<Page.Resources>
<Style TargetType="{x:Type Rectangle}">
<!-- Gives all the rectangles in this panel a white stroke. -->
<Setter Property="Stroke" Value="White"/>
<Setter Property="StrokeThickness" Value="1"/>
</Style>
</Page.Resources>
<DockPanel Margin="10" Background="White">
<!-- Header -->
<Border Background="#FFCCCCFF" DockPanel.Dock="Top">
<TextBlock Style="{StaticResource MyIntroTextBlockStyle}" Width="400">
There are a variety of syntax options for describing a SolidColorBrush. You may use
hexadecimal syntax, specify a predefined brush by name, or use property tag notation and specify ARGB or ScRGB values.
The following example shows some of the different ways to paint an area with a SolidColorBrush.
Each rectangle is painted with a blue SolidColorBrush; each SolidColorBrush
is described using a different format.
</TextBlock>
</Border>
<!-- Footer -->
<Rectangle Style="{StaticResource footerRectangleStyle}"
Fill="#FFCCCCFF"
DockPanel.Dock="Bottom"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,20,0,20">
<!--
Attribute Syntax Examples
-->
<!-- Uses a predefined SolidColorBrush, defined by the
System.Windows.Media.Brushes class. -->
<Rectangle Width="50" Height="50" Fill="Blue" />
<!-- The SolidColorBrush is described using
3-digit hexadecimal notation, which describes the
amount of red, green, and blue in the color. The resulting
rectangle is blue. -->
<Rectangle Width="50" Height="50" Fill="#00F" />
<!-- The SolidColorBrush is described using 6-digit hexadecimal notation.
The first pair of digits describes the amount of red in the color,
the next pair describes the amount of green,
and the final two digits describes the amount of blue.
The resulting rectangle is painted blue. -->
<Rectangle Width="50" Height="50" Fill="#0000FF" />
<!-- The SolidColorBrush is described using 8-digit hexadecimal notation.
The first two digits describe the
opacity of the color. The remaining digits specify the
amount of red, green, and blue in the color.
The resulting rectangle is painted blue. -->
<Rectangle Width="50" Height="50" Fill="#FF0000FF" />
<!--
Object Element Syntax Examples
-->
<!-- The SolidColorBrush's Color property is specified
using one of the predefined colors defined by the
System.Windows.Media.Colors class. -->
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="Blue" />
</Rectangle.Fill>
</Rectangle>
<!-- The SolidColorBrush's color is specified using
3-digit hexadecimal notation. The resulting
rectangle is painted blue. -->
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="#00F" />
</Rectangle.Fill>
</Rectangle>
<!-- The SolidColorBrush's color is specified using
6-digit hexadecimal notation. The resulting rectangle
is painted blue. -->
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="#0000FF" />
</Rectangle.Fill>
</Rectangle>
<!-- The SolidColorBrush's color is specified using
8-digit hexadecimal notation. The resulting
rectangle is painted blue. -->
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="#FF0000FF" />
</Rectangle.Fill>
</Rectangle>
<!-- The color properties of the SolidColorBrushes that
paint the next two rectangles are set by explicitly
using Color structures. -->
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<!-- Describes the brush's color using
ScRGB values. Each value has a range
of 0-1. -->
<Color ScA="1.0" ScR="0.0" ScG="0.0" ScB="1.0" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<!-- Describes the brush's color
using ARGB values. Each value
has a range of 0-255. -->
<Color A="255" R="0" G="0" B="255" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</DockPanel>
</Page>

Some files were not shown because too many files have changed in this diff Show More