Esempio n. 1
0
        private void Window_TextEntered(object sender, TextEventArgs e)
        {
            if (!IsSelected)
            {
                return;
            }

            // Don't handle input if the key press event did something
            if (blockTextInput)
            {
                blockTextInput = false;
                return;
            }

            string unicode = e.Unicode;

            if (unicode == "\b")
            {
                // Backspace, delete text
                if (Text.Length > 0)
                {
                    Text = Text.Substring(0, Text.Length - 1);
                }
            }
            else
            {
                // Append text
                Text = Text.Insert(cursor++, unicode);
            }
        }