I have a simple StackPanel on a grid and I want buttons within that stack panel to take up all space available (space between them should be the same). In case it's not clear, there's a pic:
<StackPanel Grid.Row="1" Grid.Column="0" Grid开发者_Go百科.ColumnSpan="2" Margin="10" Orientation="Horizontal">
<Button MinWidth="115">OK</Button>
<Button MinWidth="115">Cancel</Button>
<Button MinWidth="115">Cancel</Button>
</StackPanel>
Is it possible or do I have to just enter margins manually?
Thanks!
Make your StackPanel
into a Grid
instead (you'll need to refactor what you currently have slightly), and evenly space out all of the columns (using a width of *
), and then set each button's alignment to left/center/right respectively, which will achieve the layout you're looking for.
精彩评论