예제 #1
0
 ///<inheritdoc/>
 public int CursorStart()
 {
     return
         (provider.IsEditPosition(0)
                             ? 0
                             : provider.FindEditPositionFrom(0, true));
 }
예제 #2
0
        public void IsEditPosition()
        {
            var maskedTextProvider = new MaskedTextProvider(TestSimpleDigitMask);

            Assert.False(maskedTextProvider.IsEditPosition(6));
            Assert.True(maskedTextProvider.IsEditPosition(0));
            Assert.False(maskedTextProvider.IsEditPosition(1));
        }
예제 #3
0
        //When the text is about to be inserted:
        protected override void OnTextInput(System.Windows.Input.TextCompositionEventArgs e)
        {
            string PreviousText = this.Text;

            if (NewTextIsOk)
            {
                base.OnTextInput(e);
                if (_mprovider.VerifyString(this.Text) == false)
                {
                    this.Text = PreviousText;
                }
                while (!_mprovider.IsEditPosition(this.CaretIndex) && _mprovider.Length > this.CaretIndex)
                {
                    this.CaretIndex++;
                }
            }
            else
            {
                e.Handled = true;
            }
        }