Buttons in the corners?
I'd like to have 4 buttons one in each corner of a WPF/Silverlight window. But I want the stuff in the grid/window to be "behind" the buttons, as if they float on top.
<Grid x:Name="ButtonRoot">
<Button VerticalAlignment="Top" HorizontalAlignment="Left"
Name="bTopLeft" />
<Button VerticalAlignment="Top" HorizontalAlignment="Right"
Name="bTopRight" />
<Button VerticalAlignment="Bottom" HorizontalAlignment="Left"
Name="bBottomLeft" />
<Button Ver开发者_C百科ticalAlignment="Bottom" HorizontalAlignment="Right"
Name="bBottomRight" />
<!-- Other junk here -->
</Grid>
The problem is, the buttons will not be "over" things, as the things will "wrap" around the buttons. How do I achieve this effect?
Diagram of how I want it http://dl.compdj.com/images/stackButton.jpg
Use two grids, remember whatever is farther down the file will be on top:
<Grid>
<Grid Background="Green"><!-- put stuff here --></Grid>
<Grid><!-- this goes on top -->
<Button Width="50" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top" Content="Button" /><!-- top left button -->
<!-- etc -->
</Grid>
</Grid>
this should solve your problem
#bTopLeft {
position: absolute;
top: 0;
left: 0;
z-index: 1200;
}
精彩评论