Esempio n. 1
0
        /// <summary>
        /// Raised when the text of the TextBox changes.
        /// </summary>
        /// <param name="oldValue">The old value of the <see cref="TextBox.Text"/> property.</param>
        /// <param name="newValue">The new value of the <see cref="TextBox.Text"/> property.</param>
        protected override void OnTextChanged(string oldValue, string newValue)
        {
            if (UseTimedValidation)
            {
                if (ValidationDelay > 0.0)
                {
                    if (validationTimer != null)
                    {
                        validationTimer.Change(ValidationDelay, Timeout.Infinite);
                    }
                }
                else
                {
                    Validate();
                }
            }

            var availableWidth = ActualWidth;

            if (trimmedTextBlock != null)
            {
                availableWidth -= trimmedTextBlock.Margin.Left + trimmedTextBlock.Margin.Right;
            }

            TrimmedText = Trimming.ProcessTrimming(this, Text, availableWidth);
        }
Esempio n. 2
0
        protected override Size ArrangeOverride(Size arrangeBounds)
        {
            var arrangedSize   = base.ArrangeOverride(arrangeBounds);
            var availableWidth = arrangeBounds.Width;

            if (trimmedTextBlock != null)
            {
                availableWidth -= trimmedTextBlock.Margin.Left + trimmedTextBlock.Margin.Right;
            }

            TrimmedText = Trimming.ProcessTrimming(this, Text, availableWidth);
            return(arrangedSize);
        }