簡體   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