繁体   English   中英

布局更改时WPF保持按钮位置

[英]WPF Keep Button Position When Layout Changes

我的WPF表单上有一个按钮,其中包含以下XAML:

 <Button Name="CheckforThirdPartyUpdatesButton" Content="Check for Third Party Updates" Click="checkForThirdPartyUpdatesButton_Click" Width="Auto" MaxWidth="195" Height="25" MaxHeight="29" Margin="17,19,445,26"/>

单击按钮之前的WPF布局如下:

在此输入图像描述

问题是,一旦单击“检查第三方更新”按钮,窗口的高度将增加约500像素。 因此,由于我在按钮上设置的边距,它会下沉到窗口的按钮,并被新显示的列表框(通过按钮单击生成)覆盖。 如何强制按钮保持其位置?

使用VerticalAlignmentHorizontalAlignment设置Button位置

 <Button VerticalAlignment="Top" HorizontalAlignment="Left" Name="CheckforThirdPartyUpdatesButton" Content="Check for Third Party Updates" Click="checkForThirdPartyUpdatesButton_Click" Width="Auto" MaxWidth="195" Height="25" MaxHeight="29" Margin="17,19,445,26"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM