private void DelProfile() { if (string.IsNullOrWhiteSpace(CameraProfile?.Id)) { return; } if (MessageBox.Show("Do you realy want to delete the selected profile", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { CameraProfile.Delete(); CameraProfiles.Remove(CameraProfile); CameraProfile = CameraProfiles[0]; } }