void Native_AfterTextChanged(object sender, AfterTextChangedEventArgs e)
        {
            var startCursorPosition       = source.CursorPosition;
            var startText                 = source.Text;
            var startTextLengthDifference = TextLengthDifference;

            var maskedText = source.ApplyMask(source.Text);

            if (maskedText != source.Text)
            {
                native.Text = maskedText;

                int newCursorPosition = source.GetNewCursorPosition(startText, maskedText, startCursorPosition, startTextLengthDifference);
                native.SetSelection(newCursorPosition, newCursorPosition);
            }
        }
        protected internal void ApplyDefaultRule()
        {
            source.Locked = true;
            if (String.IsNullOrEmpty(native.Text))
            {
                return;
            }

            if (String.IsNullOrEmpty(source.FormatCharacters))
            {
                source.FormatCharacters = "";
            }

            var chars = source.FormatCharacters.ToCharArray();

            var text = native.Text.Replace(FormatCharacters, "");

            if (String.IsNullOrEmpty(source.FormatCharacters) == false)
            {
                text = text.Replace(chars, "");
            }

            var len = text.Length;

            // update MaxLength
            if (source.MaxLength <= 0 && source.Mask != null)
            {
                source.MaxLength = source.Mask.LastOrDefault().End;
            }

            if (source.MaxLength > -1)
            {
                if (len > source.MaxLength)
                {
                    text = text.Substring(0, source.MaxLength);
                }
            }

            var rules = source.Mask;

            if (rules != null)
            {
                var rule = rules.FirstOrDefault(r => r.End >= len);
                if (rule == null)
                {
                    rule = rules.Find(r => r.End == rules.Max(m => m.End));
                    text = text.Substring(0, rule.End);
                }

                // text trimmed
                if (rule.Mask != "")
                {
                    // check max length
                    if (source.MaxLengthFromMask <= 0)
                    {
                        source.MaxLengthFromMask = source.Mask.LastOrDefault().End;
                    }
                    native.Text = source.ApplyMask(text, rule);
                }
            }
            else if (source.MaxLength > 0)
            {
                native.Text = text.Substring(0, source.MaxLength);
            }

            source.RawText = source.Text.Replace(chars, "");
            source.Locked  = false;
        }