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.
OservableCollectionに入力された列と行に動的にバインドされたDataGridがあります。DataGridの行にはいくつかのボタンがあります。各ボタンでメソッドが呼び出されます(列の生成中にAddHandlerを実装しました)。
ハンドラーメソッドでは、どの行が選択されたかを取得できます。どの列が選択されたボタンか知りたい。それに基づいて、私だけが行動を起こし、それぞれのウィンドウを開くことができます。
行のどのボタンが選択されたかを知るにはどうすればよいですか?
を使用して列を取得します:
int col = myDataGrid.CurrentCell.Column.DisplayIndex; int row = seivesTorGrid.SelectedIndex;
これに基づいて、それぞれのアクションをコーディングできます。