Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在动态构建一个网格并将按钮放在其中一列中。当我单击一个按钮时,我想知道它在我的网格的哪一行。我怎样才能找到它?
在您说的按钮的 Click 事件处理程序中:
int row; Button btn = sender as Button; if (btn != null) { row = Grid.GetRow(btn); // And you have the row number... } else { // A nasty error occurred... }