I am making a C# chess app, and I want to make a border to the chess board, but there is a big space between the border and the chess board.
The XAML code:
<Grid>
<Border BorderBrush="SaddleBrown" BorderThickness="2">
<local:ChessBoard x:Name ="chessBoard"/>
</Border>
</Grid>
The ChessBoard element extends grid and has its HorizontalAlignment
and VerticalAlignment
set to Center
.
This is how it looks: The look of the application
Add following aligment attributes to the Border
VerticalAlignment="Center" HorizontalAlignment="Center"
In full code:
<Grid>
<Border BorderBrush="SaddleBrown" BorderThickness="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<local:ChessBoard x:Name ="chessBoard"/>
</Border>
</Grid>