feat: 5-17.1理解逻辑树和可视化树和5-17.2理解模板

This commit is contained in:
Bunny 2025-01-23 22:31:20 +08:00
parent de49cb117c
commit cb5f6f0787
15 changed files with 132 additions and 9 deletions

View File

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>_5_17._1理解逻辑树和可视化树</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="VisualTreeDisplayWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@
<Application x:Class="_5_WPF模板和自定义元素.App"
<Application x:Class="_5_17._1理解逻辑树和可视化树.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:_5_WPF模板和自定义元素"
xmlns:local="clr-namespace:_5_17._1理解逻辑树和可视化树"
StartupUri="MainWindow.xaml">
<Application.Resources>

View File

@ -0,0 +1,12 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace _5_17._1理解逻辑树和可视化树;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>_5_WPF模板和自定义元素</RootNamespace>
<RootNamespace>_5_17._2理解模板</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>

View File

@ -0,0 +1,10 @@
<Application x:Class="_5_17._2理解模板.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:_5_17._2理解模板"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary x:Key="GridControlTemplate" />
</Application.Resources>
</Application>

View File

@ -2,7 +2,7 @@
using System.Data;
using System.Windows;
namespace _5_WPF模板和自定义元素;
namespace _5_17._2理解模板;
/// <summary>
/// Interaction logic for App.xaml

View File

@ -0,0 +1,10 @@
using System.Windows;
[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)
)]

View File

@ -0,0 +1,37 @@
<Window x:Class="_5_17._2理解模板.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"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<ControlTemplate TargetType="{x:Type ResizeGrip}" x:Key="GridControlTemplate">
<Grid Background="{TemplateBinding Panel.Background}" SnapsToDevicePixels="True">
<Path Margin="0,0,2,2" Data="M9,0L11,0 11,11 0,11 0,9 3,9 3,6 6,6 6,3 9,3z" HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<Path.Fill>
<DrawingBrush ViewboxUnits="Absolute" TileMode="Tile" Viewbox="0,0,3,3" Viewport="0,0,3,3"
ViewportUnits="Absolute">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Geometry="M0,0L2,0 2,2 0,2z">
<GeometryDrawing.Brush>
<LinearGradientBrush EndPoint="1,0.75" StartPoint="0,0.25">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.3" Color="#fff" />
<GradientStop Offset="0.75" Color="#ffbbc5d7" />
<GradientStop Offset="1" Color="#ff6d83a9" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Path.Fill>
</Path>
</Grid>
</ControlTemplate>
</Window>

View File

@ -0,0 +1,23 @@
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.Navigation;
using System.Windows.Shapes;
namespace _5_17._2理解模板;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

View File

@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF模板和自定义元素", "5-WPF模板和自定义元素\5-WPF模板和自定义元素.csproj", "{8A23D3B8-8A39-41B7-A7E7-59DE38318ED3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-17.2理解模板", "5-17.2理解模板\5-17.2理解模板.csproj", "{2A1A5089-F23B-4742-AC20-E082C0816E9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-17.1理解逻辑树和可视化树", "5-17.1理解逻辑树和可视化树\5-17.1理解逻辑树和可视化树.csproj", "{9A8CFF92-191D-4188-8869-64E526351AA4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -8,9 +10,13 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8A23D3B8-8A39-41B7-A7E7-59DE38318ED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A23D3B8-8A39-41B7-A7E7-59DE38318ED3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A23D3B8-8A39-41B7-A7E7-59DE38318ED3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A23D3B8-8A39-41B7-A7E7-59DE38318ED3}.Release|Any CPU.Build.0 = Release|Any CPU
{2A1A5089-F23B-4742-AC20-E082C0816E9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A1A5089-F23B-4742-AC20-E082C0816E9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A1A5089-F23B-4742-AC20-E082C0816E9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A1A5089-F23B-4742-AC20-E082C0816E9F}.Release|Any CPU.Build.0 = Release|Any CPU
{9A8CFF92-191D-4188-8869-64E526351AA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A8CFF92-191D-4188-8869-64E526351AA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A8CFF92-191D-4188-8869-64E526351AA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A8CFF92-191D-4188-8869-64E526351AA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal