feat: 5-17.4改变属性触发器
This commit is contained in:
parent
fc8f5a9c5e
commit
02b17c41a0
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>_5_17._4改变属性触发器</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
<Application x:Class="_5_17._4改变属性触发器.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._4改变属性触发器"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,12 @@
|
|||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace _5_17._4改变属性触发器;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
|
@ -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)
|
||||
)]
|
|
@ -0,0 +1,28 @@
|
|||
<Window x:Class="_5_17._4改变属性触发器.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">
|
||||
<Window.Resources>
|
||||
<ControlTemplate x:Key="ButtonControlTemplate" TargetType="{x:Type Button}">
|
||||
<Border Name="Border" BorderBrush="Orange" BorderThickness="3" CornerRadius="2" Background="BlueViolet"
|
||||
TextBlock.Foreground="White">
|
||||
<ContentPresenter RecognizesAccessKey="True" Margin="{TemplateBinding Padding}" />
|
||||
</Border>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="DarkRed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="DarkKhaki" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Window.Resources>
|
||||
<StackPanel>
|
||||
<Button Template="{StaticResource ButtonControlTemplate}" Margin="15" Padding="15">按钮</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
|
@ -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._4改变属性触发器;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
|
@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-17.1理解逻辑树和可
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-17.3创建控件模板", "5-17.3创建控件模板\5-17.3创建控件模板.csproj", "{126C42EA-CC67-4FDA-8839-374F57C667DB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-17.4改变属性触发器", "5-17.4改变属性触发器\5-17.4改变属性触发器.csproj", "{A9E35059-C6E4-4539-B78C-03DD9737D1E3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -24,5 +26,9 @@ Global
|
|||
{126C42EA-CC67-4FDA-8839-374F57C667DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{126C42EA-CC67-4FDA-8839-374F57C667DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{126C42EA-CC67-4FDA-8839-374F57C667DB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A9E35059-C6E4-4539-B78C-03DD9737D1E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A9E35059-C6E4-4539-B78C-03DD9737D1E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A9E35059-C6E4-4539-B78C-03DD9737D1E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A9E35059-C6E4-4539-B78C-03DD9737D1E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
Loading…
Reference in New Issue