WPF-Base/WPF基础-2-StackPanel2/MainWindow.xaml

24 lines
1.6 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<Window x:Class="WPF基础_2_StackPanel2.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">
<Grid>
<StackPanel Margin="3">
<Label Margin="3" HorizontalAlignment="Center">垂直排放居中所有按钮margin3</Label>
<Button Margin="3" MaxWidth="200" MinWidth="100">最大宽度200最小宽度100 1</Button>
<Button Margin="3" MaxWidth="200" MinWidth="100">最大宽度200最小宽度100 2</Button>
<Button Margin="3" MaxWidth="200" MinWidth="100">最大宽度200最小宽度100 3</Button>
<Button Margin="3" MaxWidth="200" MinWidth="100">最大宽度200最小宽度100 4</Button>
<TextBox AcceptsReturn="True" MaxWidth="400" MinWidth="100" TextWrapping="Wrap" >
1. 每个按钮尺寸不能小于最小尺寸
2. 每个按钮尺寸不能超过最大尺寸(除非执行错误操作,使最大尺寸比最小尺寸还小)
3. 如果最小尺寸大于 &lt;StackPanel&gt; 宽度会被剪裁
4. 水平尺寸,默认 HorizontalAlignment设置为Stretch 所以 &lt;StackPanel&gt; 将尝试放大按钮以沾满面板整个宽度
</TextBox>
<TextBlock />
</StackPanel>
</Grid>
</Window>