【发布时间】:2011-09-04 10:36:21
【问题描述】:
我正在使用 Popup 控件,但由于某种原因,它的垂直对齐方式无法按我的预期工作。这是我拥有的 XAML:
<Grid Width="100" Height="30" >
<TextBox Text="Hello" />
<Popup IsOpen="True" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" >
<Button Content="Hello" />
</Popup>
</Grid>
我希望 Popup 的宽度为 100 像素,与它的父 Grid 相同。 但是,弹出窗口中的 Button 的行为就好像它的 HorizontalAlignment 是 Left 一样,即 Button 的宽度足以让“Hello”一词出现在其中,我不知道为什么,或者如何使它具有与包含 Grid 的宽度相同。
谢谢!
【问题讨论】:
标签: wpf silverlight popup vertical-alignment