private void CaptureImage_CanExecute(object sender, CanExecuteRoutedEventArgs e) { // Check if there is a valid webcam e.CanExecute = (SelectedWebcam != null); }