プログラムでいくつかのボタンを作成するWPFアプリケーションを作成しています。 ViewModelのボタンのOnClickコマンドをどのように作成しますか? ResetButtonですべてのTextBoxをクリアするコマンドを追加したいと思います。プログラムで作成されたボタンを使用して、WPF MVVMでOnClickコマンドを作成するにはどうすればよいですか?
new StackPanel
{
Orientation = Orientation.Horizontal,
Children =
{
new Button { Name = "SendButton", Content = "Send", MinWidth = 50, MaxHeight = 30, Margin = new Thickness(5), Background = Brushes.DodgerBlue },
new Button { Name = "ResetButton", Content = "Reset", MinWidth = 50, MaxHeight = 30, Margin = new Thickness(5), Background = Brushes.DarkRed}
}
});