mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-07 23:43:19 +02:00
Restore WPF .NET Framework content from WPF .NET (#144)
* Copy .NET 5 WPF content back into .NET Framework * Add H1 heading difference for .NET * Fix validation errors
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// // Copyright (c) Microsoft. All rights reserved.
|
||||
// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Windows;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<!--<AppResources>-->
|
||||
<Application x:Class="IntroToStylingAndTemplating.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<Style x:Key="Header1" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="15" />
|
||||
<Setter Property="FontWeight" Value="ExtraBold" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
<!--</AppResources>-->
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>IntroToStylingAndTemplating</RootNamespace>
|
||||
<UseWpf>true</UseWpf>
|
||||
<AssemblyName>IntroToStylingAndTemplating</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// // Copyright (c) Microsoft. All rights reserved.
|
||||
// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void WindowLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Clicked");
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Template Intro Sample" Loaded="WindowLoaded" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
<ControlTemplate x:Key="roundbutton" TargetType="Button">
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup Name="CommonStates">
|
||||
<VisualState Name="Normal">
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="backgroundElement"
|
||||
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
|
||||
To="{TemplateBinding Background}"
|
||||
Duration="0:0:0.3"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState Name="MouseOver">
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="backgroundElement"
|
||||
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
|
||||
To="Yellow"
|
||||
Duration="0:0:0.3"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Ellipse Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Window.Resources>
|
||||
<StackPanel Margin="10">
|
||||
<Label>Unstyled Button</Label>
|
||||
<Button>Button 1</Button>
|
||||
<Label>Rounded Button</Label>
|
||||
<Button Template="{StaticResource roundbutton}" Width="65" Height="65" Click="Button_Click">Button 2</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<!--<SnippetInitialWhole>-->
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Template Intro Sample" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<!--<SnippetInitial>-->
|
||||
<StackPanel Margin="10">
|
||||
<Label>Unstyled Button</Label>
|
||||
<Button>Button 1</Button>
|
||||
<Label>Rounded Button</Label>
|
||||
<Button>Button 2</Button>
|
||||
</StackPanel>
|
||||
<!--</SnippetInitial>-->
|
||||
</Window>
|
||||
<!--</SnippetInitialWhole>-->
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window1.xaml
|
||||
/// </summary>
|
||||
public partial class Window1 : Window
|
||||
{
|
||||
public Window1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<!--<SnippetWindowResStart>-->
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Template Intro Sample" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
|
||||
</Window.Resources>
|
||||
<StackPanel Margin="10">
|
||||
<Label>Unstyled Button</Label>
|
||||
<Button>Button 1</Button>
|
||||
<Label>Rounded Button</Label>
|
||||
<Button>Button 2</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
<!--</SnippetWindowResStart>-->
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window2.xaml
|
||||
/// </summary>
|
||||
public partial class Window2 : Window
|
||||
{
|
||||
public Window2()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window3"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Window3" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
<!--<SnippetControlTemplate>-->
|
||||
<ControlTemplate x:Key="roundbutton" TargetType="Button">
|
||||
<Grid>
|
||||
<Ellipse Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
<!--</SnippetControlTemplate>-->
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<!--<SnippetStyledButton>-->
|
||||
<StackPanel Margin="10">
|
||||
<Label>Unstyled Button</Label>
|
||||
<Button>Button 1</Button>
|
||||
<Label>Rounded Button</Label>
|
||||
<Button Template="{StaticResource roundbutton}">Button 2</Button>
|
||||
</StackPanel>
|
||||
<!--</SnippetStyledButton>-->
|
||||
|
||||
<!--<SnippetStyledButtonSize>-->
|
||||
<StackPanel Margin="10">
|
||||
<Label>Unstyled Button</Label>
|
||||
<Button>Button 1</Button>
|
||||
<Label>Rounded Button</Label>
|
||||
<Button Template="{StaticResource roundbutton}" Width="65" Height="65">Button 2</Button>
|
||||
</StackPanel>
|
||||
<!--</SnippetStyledButtonSize>-->
|
||||
</Grid>
|
||||
</Window>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window3.xaml
|
||||
/// </summary>
|
||||
public partial class Window3 : Window
|
||||
{
|
||||
public Window3()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window4"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Window4" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
<!--<SnippetControlTemplate>-->
|
||||
<ControlTemplate x:Key="roundbutton" TargetType="Button">
|
||||
<Grid>
|
||||
<!--<SnippetEllipseName>-->
|
||||
<Ellipse x:Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<!--</SnippetEllipseName>-->
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!--</SnippetControlTemplate>-->
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window4.xaml
|
||||
/// </summary>
|
||||
public partial class Window4 : Window
|
||||
{
|
||||
public Window4()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window5"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Window5" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
<ControlTemplate x:Key="roundbuttonUnneeded" TargetType="Button">
|
||||
<Grid>
|
||||
<Ellipse x:Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<!--<SnippetMouseOver>-->
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Fill" TargetName="backgroundElement" Value="AliceBlue"/>
|
||||
</Trigger>
|
||||
<!--</SnippetMouseOver>-->
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!--<SnippetCleanTemplate>-->
|
||||
<ControlTemplate x:Key="roundbutton" TargetType="Button">
|
||||
<Grid>
|
||||
<Ellipse x:Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
<!--</SnippetCleanTemplate>-->
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window5.xaml
|
||||
/// </summary>
|
||||
public partial class Window5 : Window
|
||||
{
|
||||
public Window5()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window6"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Window6" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
<!--<SnippetVisualState>-->
|
||||
<ControlTemplate x:Key="roundbutton" TargetType="Button">
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup Name="CommonStates">
|
||||
<VisualState Name="Normal">
|
||||
</VisualState>
|
||||
<VisualState Name="MouseOver">
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Ellipse x:Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
<!--</SnippetVisualState>-->
|
||||
<ControlTemplate x:Key="roundbuttonOther" TargetType="Button">
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup Name="CommonStates">
|
||||
<VisualState Name="Normal">
|
||||
<!--<SnippetNormalState>-->
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="backgroundElement"
|
||||
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
|
||||
To="{TemplateBinding Background}"
|
||||
Duration="0:0:0.3"/>
|
||||
</Storyboard>
|
||||
<!--</SnippetNormalState>-->
|
||||
</VisualState>
|
||||
<VisualState Name="MouseOver">
|
||||
<!--<SnippetMouseOverState>-->
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="backgroundElement"
|
||||
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
|
||||
To="Yellow"
|
||||
Duration="0:0:0.3"/>
|
||||
</Storyboard>
|
||||
<!--</SnippetMouseOverState>-->
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Ellipse x:Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window6.xaml
|
||||
/// </summary>
|
||||
public partial class Window6 : Window
|
||||
{
|
||||
public Window6()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.Window7"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="Template Intro Sample" SizeToContent="WidthAndHeight" MinWidth="250">
|
||||
<Window.Resources>
|
||||
<!--<FinalTemplate>-->
|
||||
<ControlTemplate x:Key="roundbutton" TargetType="Button">
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup Name="CommonStates">
|
||||
<VisualState Name="Normal">
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="backgroundElement"
|
||||
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
|
||||
To="{TemplateBinding Background}"
|
||||
Duration="0:0:0.3"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState Name="MouseOver">
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="backgroundElement"
|
||||
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
|
||||
To="Yellow"
|
||||
Duration="0:0:0.3"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Ellipse Name="backgroundElement" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" />
|
||||
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
<!--</FinalTemplate>-->
|
||||
</Window.Resources>
|
||||
<StackPanel Margin="10">
|
||||
<Label>Unstyled Button</Label>
|
||||
<Button>Button 1</Button>
|
||||
<Label>Rounded Button</Label>
|
||||
<Button Template="{StaticResource roundbutton}" Width="65" Height="65" Click="Button_Click">Button 2</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window7.xaml
|
||||
/// </summary>
|
||||
public partial class Window7 : Window
|
||||
{
|
||||
public Window7()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Clicked");
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<Window x:Class="IntroToStylingAndTemplating.ExplicitStyle"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Height="100" Width="300"
|
||||
Title="Style Intro Sample">
|
||||
<!--<ExplicitStyleDeclare>-->
|
||||
<Window.Resources>
|
||||
<Style x:Key="TitleText" TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="FontFamily" Value="Comic Sans MS"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<!--</ExplicitStyleDeclare>-->
|
||||
<!--<ExplicitStyleReference>-->
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource TitleText}">My Pictures</TextBlock>
|
||||
<TextBlock>Check out my new pictures!</TextBlock>
|
||||
</StackPanel>
|
||||
<!--</ExplicitStyleReference>-->
|
||||
</Window>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ExplicitStyle.xaml
|
||||
/// </summary>
|
||||
public partial class ExplicitStyle : Window
|
||||
{
|
||||
public ExplicitStyle()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<!--<WindowResources>-->
|
||||
<Window x:Class="IntroToStylingAndTemplating.WindowSingleResource"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:IntroToStylingAndTemplating"
|
||||
mc:Ignorable="d"
|
||||
Title="WindowSingleResource" Height="450" Width="800">
|
||||
<Window.Resources>
|
||||
|
||||
<Style x:Key="Header1" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="15" />
|
||||
<Setter Property="FontWeight" Value="ExtraBold" />
|
||||
</Style>
|
||||
|
||||
</Window.Resources>
|
||||
<Grid />
|
||||
</Window>
|
||||
<!--</WindowResources>-->
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace IntroToStylingAndTemplating
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WindowSingleResource.xaml
|
||||
/// </summary>
|
||||
public partial class WindowSingleResource : Window
|
||||
{
|
||||
public WindowSingleResource()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user