TextBoxWrapPanel
The wrap layout of RadTextBoxControlElement
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class TextBoxWrapPanel : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider, INotifyPropertyChangingEx
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementTextBoxWrapPanel...
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes a new instance of the TextBoxWrapPanel class.
public TextBoxWrapPanel()
Fields
The carriage-return character used to mark a line break in the text.
public const char CarriageReturnSymbol = '\r'
The line-feed character used to mark a line break in the text.
public const char LineFeedSymbol = '\n'
The tab character recognized when splitting text into blocks.
public const char TabSymbol = '\t'
The block type used for ordinary editable text.
protected static readonly Type TextBlockElementType
Properties
Gets the logical lines of TextBoxWrapPanel.
public LineInfoCollection Lines { get; }
Gets or sets the spacing between lines when the TextBoxWrapPanel is in multiline mode.
public int LineSpacing { get; set; }
The line spacing.
Gets or sets a value indicating whether this TextBoxWrapPanel is multiline.
public bool Multiline { get; set; }
true if multiline; otherwise, false.
Gets the concatenated text of the child blocks. Setting it raises the cancellable text-changing notification and rebuilds the blocks when accepted.
public override string Text { get; set; }
Overrides:
Gets or sets how the text is horizontally aligned in the element.
public HorizontalAlignment TextAlign { get; set; }
The horizontal text alignment.
Gets the length of the text.
public int TextLength { get; }
The length of the text.
Gets the bounds of the Viewport
public Rectangle ViewportBounds { get; }
Methods
Checks that tow block are splitted block
protected virtual bool AreSplittedBlock(ITextBlock firstBlock, ITextBlock secondBlock)
The first block.
secondBlockITextBlockThe second block.
Returns:Centers each line when it is narrower than the final size and aligns token blocks independently of the text baseline.
Arranges text blocks from the right edge of the client rectangle and aligns token blocks independently of the text baseline.
Clears the presented text
public void Clear()
Completes the previous line and initializes a new line beginning with the specified block.
protected virtual LineInfo CreateNewLine(ITextBlock block, ref SizeF desiredSize, ref int lineIndex)
The first block on the new line.
desiredSizeSizeFThe accumulated desired size of completed lines.
lineIndexintThe current line index; updated to the new line.
Returns:The initialized line information.
Clears existing blocks, creates blocks for non-empty text, and updates the layout.
Creates ordinary text blocks for the supplied text; derived views can override this to create specialized blocks.
protected virtual void CreateTextBlocksOverride(string text)
The text to divide into blocks.
Gets the baseline offset.
protected virtual float GetBaselineOffset(LineInfo line, ITextBlock textBlock)
The line.
textBlockITextBlockThe text block.
Returns:Gets the block's text.
protected virtual string GetBlockText(ITextBlock block, int start, int length)
The block.
startintThe start.
lengthintThe length.
Returns:Gets the next block for this index
Gets the previous block for this index
Gets the text between start and end position
public string GetTextRange(TextPosition startPosition, TextPosition endPosition)
The start position.
endPositionTextPositionThe end position.
Returns:Determines whether this panel has text.
Configures the panel to clip its content, stretch within its parent, and route input to the parent text control.
protected override void InitializeFields()
Overrides:
Splits text into blocks at characters accepted by CanInsert(char) and inserts them at the requested child index.
protected virtual int InsertTextBlocks(int index, string text, Type blockType)
The child index at which to insert.
textstringThe text to split into blocks.
blockTypeTypeThe block type passed to the block factory.
Returns:The index of the final inserted block, or the input index when the text is empty.
Performs measurement and arrangement of child elements.
protected void InvalidateLayout()
Builds line information from child blocks, applying wrapping only when both multiline and word-wrap are enabled.
Applies text-block formatting and then measures the block through the overridable measurement hook.
protected void MeasureTextBlock(ITextBlock textBlock, SizeF availableSize)
The block to format and measure.
availableSizeSizeFThe size available for measurement.
Measures a text block within the supplied size; derived views can override this hook to apply control-specific constraints.
protected virtual void MeasureTextBlockOverride(ITextBlock textBlock, SizeF availableSize)
The block to measure.
availableSizeSizeFThe size available for measurement.
Measures and perfroms wrapping for blocks in WordWrap mode
protected virtual bool MeasureWrap(SizeF availableSize, int blockIndex, ref SizeF desiredSize, ref int currentLineIndex, ref int offset)
The available size.
blockIndexintIndex of the current block.
desiredSizeSizeFDocument desired size.
currentLineIndexintIndex of the current line.
offsetintThe current block offset.
Returns:Merge and measure block.
protected virtual void MergeAndMeasureBlock(ITextBlock textBlock, SizeF availableSize)
The text block.
availableSizeSizeFThe available size.
Raises CreateTextBlock with a proposed block and returns the possibly replaced block.
protected ITextBlock NotifyCreateTextBlock(ITextBlock block, string text)
The proposed text block.
textstringThe text that will be assigned to the block.
Returns:The block returned from the notification.
Notifies the text changed.
protected virtual void NotifyTextChanged(string text, int caretPosition, TextBoxChangeAction action)
The text.
caretPositionintThe caret position.
actionTextBoxChangeActionThe action.
Notifies the text changing.
protected virtual bool NotifyTextChanging(int startPosition, int length, string oldText, string newText, TextBoxChangeAction action)
The start position.
lengthintThe length.
oldTextstringThe old text.
newTextstringThe new text.
actionTextBoxChangeActionThe action.
Returns:Raises the event.
protected virtual void OnCreateTextBlock(CreateTextBlockEventArgs e)
The CreateTextBlockEventArgs instance containing the event data.
Raises the event.
protected virtual void OnPropertyChanging(PropertyChangingEventArgsEx e)
The PropertyChangingEventArgs instance containing the event data.
Called when text block is formatting.
protected void OnTextBlockFormatting(ITextBlock textBlock)
The text block.
Raises the event.
protected virtual void OnTextBlockFormatting(TextBlockFormattingEventArgs e)
The TextBlockFormattingEventArgs instance containing the event data.
Clears the cached aggregate text before forwarding the change notification.
protected override void OnTextChanged(EventArgs e)
The text-change event arguments.
Overrides:
Suppresses aggregate text painting because each child block paints its own text.
protected override void PaintText(IGraphics graphics)
The graphics context used for drawing.
Overrides:
Splits an oversized text block at a measured character boundary and inserts the remaining text as a following block.
protected virtual bool SplitBlock(LineInfo currentLine, SizeF availableSize, ref ITextBlock textBlock, ref int offset)
The line receiving the first part of the block.
availableSizeSizeFThe remaining size available on the line.
textBlockITextBlockThe block to split.
offsetintThe text offset at the start of the block.
Returns:Suppresses the base text primitive because this panel renders text through its child blocks.
protected override void ToggleTextPrimitive(RadProperty property)
The text-related property being toggled.
Overrides:
Events
Occurs when an instance of ITextBlock is created
public event CreateTextBlockEventHandler CreateTextBlock
Occurs when a property value is changing.
public event PropertyChangingEventHandlerEx PropertyChanging
Implements:
Occurs when text block is formatting.
public event TextBlockFormattingEventHandler TextBlockFormatting