I am trying to align 4 buttons on a window. Currently the window looks like this:
We see that first two buttons are of same size and image and text are aligned. Since the text in the third and fourth button i.e. Settings & About is smaller than the previous two, the buttons became smaller and also image is not aligned with the first two buttons. How can I increase the size or align the third and fourth buttons. My current XAML is:
<Grid Background="#FF89A8D4">
<Grid.RowDefinitions>
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.25*" />
</Grid.RowDefinitions>
<Button Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FFF16767" BorderThickness="2.5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="/Assets/new.png" Grid.Column="0" Margin="10"/>
<TextBlock Text="Create Note" Grid.Column="1" FontSize="30" Margin="15" FontFamily="Vijaya" Foreground="White"/>
</Grid>
</Button>
<Button Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FF6060EC" BorderThickness="2.5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="/Assets/search.png" Grid.Column="0" Margin="10"/>
<TextBlock Text="Search Note" Grid.Column="1" FontSize="30" Margin="15" FontFamily="Vijaya" Foreground="White"/>
</Grid>
</Button>
<Button Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FFB09F9F" BorderThickness="2.5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="/Assets/settings.png" Grid.Column="0" Margin="10"/>
<TextBlock Text="Settings" Grid.Column="1" FontSize="30" Margin="15" FontFamily="Vijaya" Foreground="White"/>
</Grid>
</Button>
<Button Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FF899E3F" BorderThickness="2.5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="/Assets/about.png" Grid.Column="0" Margin="10"/>
<TextBlock Text="About " Grid.Column="1" FontSize="30" Margin="15" FontFamily="Vijaya" Foreground="White"/>
</Grid>
</Button>
</Grid>
HorizontalAlignment
on aButton
fromCenter
toStretch
or remove it altogether – dkozl