'Get Grid Row and Grid column of button pressed
I have the following buttons:
<Button Grid.Row="0" Grid.Column="0" FontSize="48"></Button>
<Button Grid.Row="1" Grid.Column="0" FontSize="48"></Button>
<Button Grid.Row="2" Grid.Column="0" FontSize="48"></Button>
<Button Grid.Row="0" Grid.Column="1" FontSize="48"></Button>
<Button Grid.Row="0" Grid.Column="2" FontSize="48"></Button>
<Button Grid.Row="1" Grid.Column="1" FontSize="48"></Button>
<Button Grid.Row="1" Grid.Column="2" FontSize="48"></Button>
<Button Grid.Row="2" Grid.Column="1" FontSize="48"></Button>
<Button Grid.Row="2" Grid.Column="2" FontSize="48"></Button>
Whenever pressed, these buttons will call:
private void Button_Click(object sender, RoutedEventArgs e)
My question is how do I retrieve the column and row of the button that's been pressed?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|