nature_net.user_controls.WPFExtensions.InsertText C# (CSharp) Метод

InsertText() публичный статический Метод

Insert the given text into this TextBox at the current CaretIndex, and replacing any already-selected text.
public static InsertText ( this textbox, string sTextToInsert ) : void
textbox this The TextBox to insert the new text into
sTextToInsert string The text to insert into this TextBox
Результат void
        public static void InsertText(this System.Windows.Controls.TextBox textbox, string sTextToInsert)
        {
            int iCaretIndex = textbox.CaretIndex;
            int iOriginalSelectionLength = textbox.SelectionLength;
            string sOriginalContent = textbox.Text;
            textbox.SelectedText = sTextToInsert;
            if (iOriginalSelectionLength > 0)
            {
                textbox.SelectionLength = 0;
            }
            textbox.CaretIndex = iCaretIndex + 1;
        }