示例#1
0
        /// <summary>
        ///     Creates the visual tree for text based cells.
        /// </summary>
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            IntellisenseTextBox textBox = new IntellisenseTextBox();

            SyncProperties(textBox);

            ApplyStyle(/* isEditing = */ true, /* defaultToElementStyle = */ false, textBox);
            ApplyBinding(textBox, TextBox.TextProperty);

            return(textBox);
        }
示例#2
0
        private static bool PlaceCaretOnTextBox(IntellisenseTextBox textBox, Point position)
        {
            int characterIndex = textBox.GetCharacterIndexFromPoint(position, /* snapToText = */ false);

            if (characterIndex >= 0)
            {
                textBox.Select(characterIndex, 0);
                return(true);
            }

            return(false);
        }