Original I have code event in code behind.
private async void Start_Click(object sender, RoutedEventArgs e) { try { Start.IsEnabled = false; Start.IsHitTestVisible = false; Start.Background = Brushes.Red;
Now I want to move code to ViewModel as MVVW pattern.
<Button Grid.Column="1" Grid.Row="3" Command="{Binding StartProcess}" Width="200">Start</Button>
using GalaSoft.MvvmLight.Command; public RelayCommand StartProcess { get; set; } public MainWindowViewModel() { StopProcess = new RelayCommand(StopProcessExecute); // etc. } private void StartProcessExecute() { // how to disable the button. // blah blah }