我想要做的是会计系统我有一些堆栈面板有三个按钮我想要的是当我最大化屏幕按钮仍然固定在他们的位置并且矩形不适合整个屏幕
<StackPanel HorizontalAlignment="Left" Height="90" Margin="0,29,0,0"
VerticalAlignment="Top" Width="1016" Orientation="Horizontal">
<Button Content="Invioice" Height="90" Margin="0,0,0,0" Width="250"/>
<Button Content="Customer" Height="90" Margin="100,0,0,0" Width="250"/>
<Button Content="Expenses" Height="90" Margin="100,0,0,0" Width="250"/>
</StackPanel>
<Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="859"
Margin="10,124,0,0" Stroke="Black" VerticalAlignment="Top"
Width="996"/>
答案 0 :(得分:1)
问题不明确,但您可以使用Grid
和Grid.RowDefinitions
以及Grid.ColumnDefinitions
在这个例子中,这将stackpanel定义在顶部,矩形始终在底部并适合窗口
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="90"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Height="90" Orientation="Horizontal">
<Button Content="Invioice" Height="90" Margin="0,0,0,0" Width="250"/>
<Button Content="Customer" Height="90" Margin="100,0,0,0" Width="250"/>
<Button Content="Expenses" Height="90" Margin="100,0,0,0" Width="250"/>
</StackPanel>
<Rectangle Grid.Row="1" Fill="#FFF4F4F5" Stroke="Black" ClipToBounds="True"/>
</Grid>