wpfの仕組みを理解するのに問題があることを告白しなければなりません。MainwindowにネストされたユーザーコントロールBottomControlがあります。BottomControl の Button がクリックされた場合、Mainwindow で特定の変更 (たとえば、テキスト ボックスの内容の変更) が発生するようにします。
明らかに、Click_Event でパブリック プロシージャを呼び出すだけで簡単に実行できますが、これはあまり洗練されたものではありません。RoutedCommands を使用するまでになりました。
public static readonly RoutedCommand BottomGridReSize = new RoutedCommand();
ユーザーコントロールのXAMLで
<Button Style="{StaticResource TransparentButton}" Command="{x:Static local:Commands.BottomGridReSize}" >
MainWindowのコードで
void BottomGridReSize_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
void BottomGridReSize_Executed(object sender, ExecutedRoutedEventArgs e)
{
\\Do some stuff
}
ist はこれらのイベントを認識しないため、明らかに Mainwindow はこれらのイベントを使用できません。私は何が欠けていますか?
どんな助けでも大歓迎です
ジョン