protected override void OnTextBlockFormatting(TextBlockFormattingEventArgs e)
        {
            TokenizedTextBlockElement textBlock = e.TextBlock as TokenizedTextBlockElement;

            if (textBlock != null)
            {
                textBlock.AllowRemove = !this.IsReadOnly && this.ShowRemoveButton;
            }
            base.OnTextBlockFormatting(e);
        }
Example #2
0
        protected virtual void Detach(ITextBlock textBlock)
        {
            TokenizedTextBlockElement textBlockElement = textBlock as TokenizedTextBlockElement;

            if (textBlockElement == null)
            {
                return;
            }
            textBlockElement.ContentElement.TextChanging += new TextChangingEventHandler(this.OnContentElementTextChanging);
            textBlockElement.Item.PropertyChanged        -= new PropertyChangedEventHandler(this.OnTokenItemPropertyChanged);
        }
Example #3
0
        protected virtual RadTokenizedTextItem OnRemoveBlock(ITextBlock textBlock)
        {
            TokenizedTextBlockElement textBlockElement  = textBlock as TokenizedTextBlockElement;
            RadTokenizedTextItem      tokenizedTextItem = (RadTokenizedTextItem)null;

            if (textBlockElement != null)
            {
                tokenizedTextItem = textBlockElement.Item;
                this.Items.Remove(tokenizedTextItem);
            }
            this.Detach(textBlock);
            return(tokenizedTextItem);
        }
Example #4
0
        protected virtual RadTokenizedTextItem OnInsertBlock(ITextBlock textBlock)
        {
            string text = textBlock.Text;
            RadTokenizedTextItem      tokenizedTextItem = (RadTokenizedTextItem)null;
            TokenizedTextBlockElement textBlockElement  = textBlock as TokenizedTextBlockElement;

            if (textBlockElement != null)
            {
                tokenizedTextItem = textBlockElement.Item;
                RadListDataItem radListDataItem = this.textBox.ListElement.Find(text);
                tokenizedTextItem.Value = radListDataItem?.Value;
                this.Items.Add(tokenizedTextItem);
            }
            this.Attach(textBlock);
            return(tokenizedTextItem);
        }
        public override bool ProcessMouseDown(MouseEventArgs e)
        {
            bool flag = base.ProcessMouseDown(e);

            if (e.Button == MouseButtons.Left && flag)
            {
                this.TextBox.CloseDropDown();
                ITextBlock textBlockAtPoint = this.GetTextBlockAtPoint(e.Location);
                TokenizedTextBlockElement textBlockElement = textBlockAtPoint as TokenizedTextBlockElement;
                if (textBlockElement != null && !textBlockElement.RemoveButton.ControlBoundingRectangle.Contains(e.Location))
                {
                    LineInfo line = this.TextBox.ViewElement.Lines.BinarySearchByBlockIndex(textBlockAtPoint.Index);
                    this.TextBox.Navigator.Select(new TextPosition(line, textBlockAtPoint, 0), new TextPosition(line, textBlockAtPoint, textBlockAtPoint.Length));
                }
            }
            return(flag);
        }