【发布时间】:2018-01-19 15:23:24
【问题描述】:
所以我想知道在用户控件/页面上将 HorizontalAlignment 设置为左时是否可以在页面上拉伸扩展器。
问题是我们不想在扩展器上设置宽度,因为我们希望在调整应用程序大小时调整它的大小。我们也不能在扩展器上设置最小宽度,因为我们的应用程序也有 850 的最小宽度和 1200 的正常宽度,我们希望扩展器始终拉伸到最大尺寸。
代码示例:
<UserControl x:Class="WpfApp1.Window1"
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:WpfApp1"
mc:Ignorable="d"
d:DesignWidth="1100" HorizontalAlignment="Left">
<DockPanel>
<StackPanel>
<Expander Background="LightBlue"/>
</StackPanel>
</DockPanel>
</UserControl>
我们的主要目标是创建如下图所示的东西,其中单选按钮始终位于右侧,并且扩展器的大小适合其可用空间。
【问题讨论】: