我有一个包含两个元素的DockPanel。第一个元素需要跨越整个DockPanel。第二个元素需要右对齐,但“浮动”在另一个元素的顶部。当我注释掉第二个元素时,第一个元素确实跨越了整个停靠面板,并且看起来很合适。当我有第二个元素时,它会推入第一个元素并挤压它。
<DockPanel HorizontalAlignment="Stretch" Margin="6,8,0,8" Grid.Row="1" Grid.Column="0">
<shared:YesNoControl Panel.ZIndex="0"></shared:YesNoControl>
<extended:IntegerUpDown Panel.ZIndex="1" Height="25" HorizontalAlignment="Right" Width="100"></extended:IntegerUpDown>
</DockPanel>怎样才能达到这个效果呢?我基本上希望第二个元素甚至不影响第一个元素,只是出现在它的上面。
发布于 2013-12-07 00:56:24
使用空白处尝试这个简单的方法:

<DockPanel Grid.Row="2" HorizontalAlignment="Stretch">
<TextBox Background="AliceBlue" Text="This is a text box contains a great deal of useless text!!!!" />
<Button Width="20" Height="20" Margin="-20,0,0,0" />
</DockPanel>按钮覆盖了文本,使其看起来像是“悬停”。
https://stackoverflow.com/questions/20405746
复制相似问题