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.
グリッドにコントロールがあり、グリッドにアクセスしたいと思います。コードビハインドのグリッドにはアクセスできませんが、コントロールのインスタンスにはアクセスできます。コントロールのインスタンスを使用してグリッドの親を取得する方法はありますか?
コントロールがグリッド内のボタンであり、クリックイベントを介してこのボタンにアクセスすると仮定すると、これがグリッドにアクセスする方法です。
private void button1_Click(object sender, RoutedEventArgs e) { Grid x = (sender as Button).Parent as Grid; }