WP7 Grid Position
I really need help on this, I have a 9x9 grid in WP7, with gridlines. I have a character in each of the grid "cell".
How could I retrieve the position in the grid using [,] or any other means? Hopefully I can get the position through: grid[col, row]
I tried using this: char[,] grid = new char[numColumnsToAdd, numRowsToAdd];
But it didn't 开发者_StackOverflow社区work.
Thanks.
I would generally recommend to only use grid cells and rows for layout purposes and not to track the current row/cell. But since you are already doing this, I would simply track clicks on each control (e.g. Label) via a single event handler. Then, simply check the row or cell via:
object row = ((TextBlock)sender).GetValue(Grid.RowProperty);
object cell = ((TextBlock)sender).GetValue(Grid.CellProperty);
精彩评论