<Window x:Class="WpfApp313.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:WpfApp313" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <DockPanel> <Button DockPanel.Dock="Left" Background="red">1 (left)</Button> <Button DockPanel.Dock="Left" Background="Brown">2 (left)</Button> <Button DockPanel.Dock="Left" Background="Yellow">3 (left)</Button> <Button DockPanel.Dock="Right" Background="Blue">4 (Top)</Button> <Button DockPanel.Dock="Top" Background="Cyan">5 (Top)</Button> <Button DockPanel.Dock="Bottom" Background="Pink">6 (Bottom)</Button> <Button DockPanel.Dock="Bottom" Background="Wheat">7 (Bottom)</Button> <Button Background="Gray">8</Button> </DockPanel> </Window>
标签:WPF,Bottom,DockPanel,Top,left From: https://www.cnblogs.com/Fred1987/p/18389201