feat: WPF控件-5-RadioButton

This commit is contained in:
Bunny 2025-01-04 10:54:56 +08:00
parent 7511cb09ca
commit ed70a4afcc
7 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<Application x:Class="WPF控件_5_RadioButton.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPF控件_5_RadioButton"
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控件_5_RadioButton;
/// <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,29 @@
<Window x:Class="WPF控件_5_RadioButton.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控件_5_RadioButton"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<StackPanel>
<GroupBox Margin="5">
<StackPanel>
<RadioButton>Group 1</RadioButton>
<RadioButton>Group 2</RadioButton>
<RadioButton>Group 3</RadioButton>
<!-- 希望单独分离出一个组,但是又不希望离开原来分组 -->
<RadioButton Margin="0 10 0 0 " GroupName="Group2">Group 3</RadioButton>
</StackPanel>
</GroupBox>
<GroupBox Margin="5">
<StackPanel>
<RadioButton>Group4</RadioButton>
<RadioButton>Group4</RadioButton>
<RadioButton>Group4</RadioButton>
<RadioButton Margin="0 10 0 0 " GroupName="Group2">Group4</RadioButton>
</StackPanel>
</GroupBox>
</StackPanel>
</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 WPF控件_5_RadioButton;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

View File

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

View File

@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-3-内容原则",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-4-标签", "WPF控件-4-标签\WPF控件-4-标签.csproj", "{0CCEE398-E31A-4384-B16B-6D137F758716}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-5-RadioButton", "WPF控件-5-RadioButton\WPF控件-5-RadioButton.csproj", "{C3961D75-D2BF-4979-B985-1FD652CDFC0C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -30,5 +32,9 @@ Global
{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
{C3961D75-D2BF-4979-B985-1FD652CDFC0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3961D75-D2BF-4979-B985-1FD652CDFC0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3961D75-D2BF-4979-B985-1FD652CDFC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3961D75-D2BF-4979-B985-1FD652CDFC0C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal