feat: WPF控件-4-标签

This commit is contained in:
Bunny 2025-01-02 21:21:34 +08:00
parent 4ca6d536d3
commit 7511cb09ca
7 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<Application x:Class="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:WPF控件_4_标签"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@ -0,0 +1,12 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace WPF控件_4_标签;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

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,21 @@
<Window x:Class="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"
xmlns:local="clr-namespace:WPF控件_4_标签"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<StackPanel>
<Label Target="{Binding ElementName=TextA}">LabelA</Label>
<TextBox Name="TextA"></TextBox>
<Label Target="{Binding ElementName=TExtB}">LabelB</Label>
<TextBox Name="TExtB"></TextBox>
<DockPanel HorizontalAlignment="Left">
<Button IsCancel="True" Click="ButtonBase_OnClick">取消按钮-按下esc键会触发</Button>
<Button IsDefault="True" Name="Confirm" Click="Confirm_OnClick">确认按钮-按下回车键会触发</Button>
</DockPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,33 @@
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 WPF控件_4_标签;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
Console.WriteLine("Press");
}
private void Confirm_OnClick(object sender, RoutedEventArgs e)
{
Console.WriteLine("Confirm");
}
}

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>WPF控件_4_标签</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

View File

@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-2-鼠标光标",
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-3-内容原则", "WPF控件-3-内容原则\WPF控件-3-内容原则.csproj", "{AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-3-内容原则", "WPF控件-3-内容原则\WPF控件-3-内容原则.csproj", "{AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-4-标签", "WPF控件-4-标签\WPF控件-4-标签.csproj", "{0CCEE398-E31A-4384-B16B-6D137F758716}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -24,5 +26,9 @@ Global
{AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}.Release|Any CPU.Build.0 = Release|Any CPU {AFDCB2E1-2BBF-4554-8673-BA92F5FD4D3C}.Release|Any CPU.Build.0 = Release|Any CPU
{0CCEE398-E31A-4384-B16B-6D137F758716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CCEE398-E31A-4384-B16B-6D137F758716}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CCEE398-E31A-4384-B16B-6D137F758716}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CCEE398-E31A-4384-B16B-6D137F758716}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal