File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -195,20 +195,16 @@ namespace MyWpfApp.ViewModel
195195{
196196 partial class EmployeeViewModel : global::MvvmGen.ViewModels.ViewModelBase
197197 {
198+ private IDelegateCommand? _saveCommand;
199+
198200 public EmployeeViewModel()
199201 {
200- this.InitializeCommands();
201202 this.OnInitialize();
202203 }
203204
204205 partial void OnInitialize();
205206
206- private void InitializeCommands()
207- {
208- SaveCommand = new DelegateCommand(_ => Save(), _ => CanSave());
209- }
210-
211- public DelegateCommand SaveCommand { get; private set; }
207+ public IDelegateCommand SaveCommand => _saveCommand ??= new DelegateCommand(_ => Save(), _ => CanSave());
212208
213209 public string FirstName { ... }
214210
@@ -276,10 +272,11 @@ namespace MyWpfApp.ViewModel
276272{
277273 partial class EmployeeViewModel : global::MvvmGen.ViewModels.ViewModelBase
278274 {
275+ private IDelegateCommand? _saveCommand;
276+
279277 public EmployeeViewModel(MvvmGen.Events.IEventAggregator eventAggregator)
280278 {
281279 this.EventAggregator = eventAggregator;
282- this.InitializeCommands();
283280 this.OnInitialize();
284281 }
285282
You can’t perform that action at this time.
0 commit comments