StackPanel创建
This commit is contained in:
parent
c296354f7b
commit
fea3514def
|
@ -0,0 +1,9 @@
|
|||
<Application x:Class="WPF基础_2_StackPanel.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:WPF基础_2_StackPanel"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,12 @@
|
|||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace WPF基础_2_StackPanel;
|
||||
|
||||
/// <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="WPF基础_2_StackPanel.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">
|
||||
|
||||
<!-- 水平,默认是横向排列 -->
|
||||
<!-- VerticalAlignment 水平方向排放 -->
|
||||
<!-- HorizontalAlignment 垂直方向排放 -->
|
||||
<StackPanel Orientation="Vertical">
|
||||
<!-- 垂直方向 居中 -->
|
||||
<Label HorizontalAlignment="Center"> 堆叠面板</Label>
|
||||
<!-- 垂直方向 靠左 -->
|
||||
<Button HorizontalAlignment="Left">按钮1</Button>
|
||||
<!-- 垂直方向 靠右 -->
|
||||
<Button HorizontalAlignment="Right">按钮2</Button>
|
||||
<!-- 左上右下 -->
|
||||
<Button HorizontalAlignment="Stretch" Margin="5">按钮3</Button>
|
||||
<!-- 左右 上下 -->
|
||||
<Button Margin="3 2 ">按钮4</Button>
|
||||
<!-- 左上右下 -->
|
||||
<Button Margin="5 3 5 3">按钮5</Button>
|
||||
<!-- 使用代码控制 -->
|
||||
<Button Name="CmdButton">代码设置</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
|
@ -0,0 +1,17 @@
|
|||
using System.Windows;
|
||||
|
||||
namespace WPF基础_2_StackPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 支持三种重载方式
|
||||
CmdButton.Margin = new Thickness(10);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>WPF基础_2_StackPanel</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-1-1-只使用代
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-1-2-和xaml一起创建", "WPF基础-1-2-和xaml一起创建\WPF基础-1-2-和xaml一起创建.csproj", "{BEC5A610-FCE9-4A38-AE54-E1C516CED5E6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF基础-2-StackPanel", "WPF基础-2-StackPanel\WPF基础-2-StackPanel.csproj", "{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -30,5 +32,9 @@ Global
|
|||
{BEC5A610-FCE9-4A38-AE54-E1C516CED5E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BEC5A610-FCE9-4A38-AE54-E1C516CED5E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BEC5A610-FCE9-4A38-AE54-E1C516CED5E6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0BF66DA6-EDC2-41D2-8D92-ABF4383B8DFB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
Loading…
Reference in New Issue