I am doing a 15 puzzle game on wpf and xaml where you need to move the empty tile in a grid to solve the puzzle. (see the linked image for context) I want to know how I can go about changing a button's coordinates when switching it with the coordinates of the empty tile using the up,down,left,right buttons. Here below you have an example of the coordinates i am talking about, .row and .column.
<Button x:Name="Button10" Grid.Column="1" Grid.Row="0" Content="3"/>```
You can obtain the position of an element by calling it as part of the
Grid.GetRow
orGrid.GetColumn
methods.It might be best to create an object type for this so you can keep track of many buttons and what their positions were even after they moved.
and then you can mark the current position of multiple grid items
and from there you can call these objects to move grid elements