5-WPF样式和行为-9事件触发器
This commit is contained in:
parent
518b429070
commit
a5a54411a2
|
@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-7简
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-8多个触发器", "5-WPF样式和行为-8多个触发器\5-WPF样式和行为-8多个触发器.csproj", "{48E9E0D9-03B6-4A5B-8516-601081D83A1D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-8多个触发器", "5-WPF样式和行为-8多个触发器\5-WPF样式和行为-8多个触发器.csproj", "{48E9E0D9-03B6-4A5B-8516-601081D83A1D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-9事件触发器", "5-WPF样式和行为-9事件触发器\5-WPF样式和行为-9事件触发器.csproj", "{BC9BB464-80E7-450B-9430-A1DFEDD82B7E}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -108,5 +110,9 @@ Global
|
||||||
{48E9E0D9-03B6-4A5B-8516-601081D83A1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{48E9E0D9-03B6-4A5B-8516-601081D83A1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{48E9E0D9-03B6-4A5B-8516-601081D83A1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{48E9E0D9-03B6-4A5B-8516-601081D83A1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{48E9E0D9-03B6-4A5B-8516-601081D83A1D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{48E9E0D9-03B6-4A5B-8516-601081D83A1D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BC9BB464-80E7-450B-9430-A1DFEDD82B7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{BC9BB464-80E7-450B-9430-A1DFEDD82B7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{BC9BB464-80E7-450B-9430-A1DFEDD82B7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{BC9BB464-80E7-450B-9430-A1DFEDD82B7E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<RootNamespace>_5_WPF样式和行为_9事件触发器</RootNamespace>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="_5_WPF样式和行为_9事件触发器.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样式和行为_9事件触发器"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace _5_WPF样式和行为_9事件触发器;
|
||||||
|
|
||||||
|
/// <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,42 @@
|
||||||
|
<Window x:Class="_5_WPF样式和行为_9事件触发器.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="_5_WPF样式和行为_9事件触发器" Height="450" Width="800">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style x:Key="BigFontButtonStyle">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="Control.FontFamily" Value="黑体" />
|
||||||
|
<Setter Property="Control.FontSize" Value="18" />
|
||||||
|
</Style.Setters>
|
||||||
|
|
||||||
|
<Style.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="Mouse.MouseEnter">
|
||||||
|
<EventTrigger.Actions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="FontSize" To="22" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger.Actions>
|
||||||
|
</EventTrigger>
|
||||||
|
|
||||||
|
<EventTrigger RoutedEvent="Mouse.MouseLeave">
|
||||||
|
<EventTrigger.Actions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Duration="0:0:1" Storyboard.TargetProperty="FontSize" To="16" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger.Actions>
|
||||||
|
</EventTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<StackPanel>
|
||||||
|
<Button Style="{StaticResource BigFontButtonStyle}">按钮</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_WPF样式和行为_9事件触发器;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue