5-WPF样式和行为-4关联事件处理程序
This commit is contained in:
parent
d092d14b23
commit
f7829163d2
|
@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-2创
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-3设置属性", "5-WPF样式和行为-3设置属性\5-WPF样式和行为-3设置属性.csproj", "{D8E267CE-6F9F-4455-A3F4-849CA9FB3CDC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-4关联事件处理程序", "5-WPF样式和行为-4关联事件处理程序\5-WPF样式和行为-4关联事件处理程序.csproj", "{CB328FFD-8DDD-4AD1-B45B-7CE14D229E26}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -78,5 +80,9 @@ Global
|
|||
{D8E267CE-6F9F-4455-A3F4-849CA9FB3CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D8E267CE-6F9F-4455-A3F4-849CA9FB3CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8E267CE-6F9F-4455-A3F4-849CA9FB3CDC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CB328FFD-8DDD-4AD1-B45B-7CE14D229E26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CB328FFD-8DDD-4AD1-B45B-7CE14D229E26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB328FFD-8DDD-4AD1-B45B-7CE14D229E26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB328FFD-8DDD-4AD1-B45B-7CE14D229E26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>_5_WPF样式和行为_4关联事件处理程序</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="public\003540AH4M72.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
<Application x:Class="_5_WPF样式和行为_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_WPF样式和行为_4关联事件处理程序"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,12 @@
|
|||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace _5_WPF样式和行为_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,18 @@
|
|||
<Window x:Class="_5_WPF样式和行为_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"
|
||||
Icon="public/003540AH4M72.jpg" Title="_5_WPF样式和行为_4关联事件处理程序" Height="450" Width="800">
|
||||
<Window.Resources>
|
||||
<Style x:Key="MouseOverHighLightStyle">
|
||||
<EventSetter Event="TextBlock.MouseEnter" Handler="EventSetter_MoueEnter" />
|
||||
<EventSetter Event="TextBlock.MouseLeave" Handler="EventSetter_MouseLeave" />
|
||||
<Setter Property="TextBlock.Padding" Value="5 " />
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource MouseOverHighLightStyle}">Hover 这个</TextBlock>
|
||||
</StackPanel>
|
||||
</Window>
|
|
@ -0,0 +1,27 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace _5_WPF样式和行为_4关联事件处理程序;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EventSetter_MoueEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
((TextBlock)sender).Background = new SolidColorBrush(Colors.LightGoldenrodYellow);
|
||||
}
|
||||
|
||||
private void EventSetter_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
((TextBlock)sender).Background = null;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
Loading…
Reference in New Issue