Skip to content

Commit

Permalink
Property changed added
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeyasri-Murugan committed Dec 22, 2023
1 parent 67880fa commit e163851
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions DataFormMAUI/Model/ContactFormModel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using SQLite;
using Syncfusion.Maui.DataForm;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace DataFormMAUI
{
public class ContactFormModel
public class ContactFormModel : INotifyPropertyChanged
{
[PrimaryKey, AutoIncrement]
[Display(AutoGenerateField = false)]
Expand Down Expand Up @@ -38,6 +39,7 @@ public string Mobile
{
mobile = new string(value.Where(c => Char.IsLetterOrDigit(c)).ToArray());
}
RaisePropertyChanged(nameof(Mobile));
if (mobile.Length == 10)
this.MaskedMobileText = string.Format("({0}) {1}-{2}", mobile.Substring(0, 3), mobile.Substring(3, 3), mobile.Substring(6));
}
Expand All @@ -60,7 +62,25 @@ public string Mobile

public string Email { get; set; }

private string maskedMobileText;

[Display(AutoGenerateField = false)]
public string MaskedMobileText { get; set; }
public string MaskedMobileText
{
get { return maskedMobileText; }
set
{
this.maskedMobileText = value;
RaisePropertyChanged(nameof(MaskedMobileText));
}
}

public event PropertyChangedEventHandler PropertyChanged;

private void RaisePropertyChanged(string name)
{
if (PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}

0 comments on commit e163851

Please sign in to comment.