Tuesday, December 19, 2017

Create extention classes for update source

 public static class ExtensionClass
    {
        public static void UpdateBinding(this PasswordBox textBox)
        {
            if (textBox!=null)
            {
                BindingExpression bindingExpression =
                    textBox.GetBindingExpression(PasswordBox.PasswordProperty);
                if (bindingExpression != null)
                {
                    bindingExpression.UpdateSource();
                }
            }
          
        }

        public static void UpdateBinding(this TextBox textBox)
        {  
            if (textBox != null)
            {
                BindingExpression bindingExpression =
                    textBox.GetBindingExpression(TextBox.TextProperty);
                if (bindingExpression != null)
                {
                    bindingExpression.UpdateSource();
                }
            }

        }


    }

Create base class for Notifiy

 public class BaseViewModel : INotifyPropertyChanged
    {
        private Frame frame { get { return App.myFrame; } }

        public event PropertyChangedEventHandler PropertyChanged;

        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
        {
            if (Object.Equals(storage, value))
            {
                return false;
            }
            storage = value;
            this.OnPropertyChanged(propertyName);
            return true;
        }

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            var eventHandler = this.PropertyChanged;
            if (eventHandler != null)
            {
                try
                {
                    eventHandler(this, new PropertyChangedEventArgs(propertyName));

                }
                catch (Exception propExp)
                {
                    LoggingHelper.ExceptionLogging(propExp, "OnPropertyChanged");
                }
            }
        }      


    }

Create extention classes for update source

 public static class ExtensionClass     {         public static void UpdateBinding(this PasswordBox textBox)         {             if (text...