Browse Source

Set property value before using any Interfaces

pull/4053/head
usUyGBx 6 years ago
committed by GitHub
parent
commit
fd30ecc903
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      samples/ControlCatalog/Models/Person.cs

6
samples/ControlCatalog/Models/Person.cs

@ -21,12 +21,12 @@ namespace ControlCatalog.Models
get => _firstName; get => _firstName;
set set
{ {
_firstName = value;
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
SetError(nameof(FirstName), "First Name Required"); SetError(nameof(FirstName), "First Name Required");
else else
SetError(nameof(FirstName), null); SetError(nameof(FirstName), null);
_firstName = value;
OnPropertyChanged(nameof(FirstName)); OnPropertyChanged(nameof(FirstName));
} }
@ -37,12 +37,12 @@ namespace ControlCatalog.Models
get => _lastName; get => _lastName;
set set
{ {
_lastName = value;
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
SetError(nameof(LastName), "Last Name Required"); SetError(nameof(LastName), "Last Name Required");
else else
SetError(nameof(LastName), null); SetError(nameof(LastName), null);
_lastName = value;
OnPropertyChanged(nameof(LastName)); OnPropertyChanged(nameof(LastName));
} }
} }
@ -95,4 +95,4 @@ namespace ControlCatalog.Models
return null; return null;
} }
} }
} }

Loading…
Cancel
Save