Skip to content

Commit e163851

Browse files
Property changed added
1 parent 67880fa commit e163851

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

DataFormMAUI/Model/ContactFormModel.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
using SQLite;
22
using Syncfusion.Maui.DataForm;
3+
using System.ComponentModel;
34
using System.ComponentModel.DataAnnotations;
45

56
namespace DataFormMAUI
67
{
7-
public class ContactFormModel
8+
public class ContactFormModel : INotifyPropertyChanged
89
{
910
[PrimaryKey, AutoIncrement]
1011
[Display(AutoGenerateField = false)]
@@ -38,6 +39,7 @@ public string Mobile
3839
{
3940
mobile = new string(value.Where(c => Char.IsLetterOrDigit(c)).ToArray());
4041
}
42+
RaisePropertyChanged(nameof(Mobile));
4143
if (mobile.Length == 10)
4244
this.MaskedMobileText = string.Format("({0}) {1}-{2}", mobile.Substring(0, 3), mobile.Substring(3, 3), mobile.Substring(6));
4345
}
@@ -60,7 +62,25 @@ public string Mobile
6062

6163
public string Email { get; set; }
6264

65+
private string maskedMobileText;
66+
6367
[Display(AutoGenerateField = false)]
64-
public string MaskedMobileText { get; set; }
68+
public string MaskedMobileText
69+
{
70+
get { return maskedMobileText; }
71+
set
72+
{
73+
this.maskedMobileText = value;
74+
RaisePropertyChanged(nameof(MaskedMobileText));
75+
}
76+
}
77+
78+
public event PropertyChangedEventHandler PropertyChanged;
79+
80+
private void RaisePropertyChanged(string name)
81+
{
82+
if (PropertyChanged != null)
83+
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
84+
}
6585
}
6686
}

0 commit comments

Comments
 (0)