Don't.
Instead, create an enum:
private enum ChessPiece
{
Pawn = 1,
Rook = 2,
Knight = 3,
Bishop = 4,
Queen = 5,
King = 6,
Black = 16,
White = 0,
}
and assign the piece value to the Button.Tag field.
Then you can retrieve the piece type and compare that using a switch statement or an if, or ...
private void ChessBlock_clicked(object sender, RoutedEventArgs e)
{
if (sender is Button btn)
{
ChessPiece piece = (ChessPiece)btn.Tag;
switch (piece & ~ChessPiece.Black)
{
case ChessPiece.Pawn:
break;
case ChessPiece.Rook:
break;
}
And your code becomes easier to read, and a lot less prone to errors.