How to have button stretched over all window width: XAML:
<Window x:Class="DIexamples.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Button Content="Button" Margin="0,23,0,0" VerticalAlignment="Top" /> <Button Content="Button" Margin="0,0,0,0" VerticalAlignment="Top" /> </Grid> </Window>
Important lines to notice are:
<Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions>
And attribute: Margin="0,23,0,0"