TextBlock
Measures and draws plain text or inline runs, applying block-level formatting and layout settings.
Definition
Namespace:Telerik.WinControls.Spreadsheet.UI
Assembly:Telerik.WinControls.RadSpreadsheet.dll
Syntax:
public class TextBlock : FrameworkElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, IShortcutProvider, IStylableElement, IStylableNode, ISupportDrop
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIElementFrameworkElementTextBlock...
Implements:
Inherited Members
Constructors
Creates a text block with an empty inline collection.
public TextBlock()
Fields
Identifies the line-height property. The Spreadsheet text block stores this value but does not use it to calculate measured height.
public static RadProperty LineHeightProperty
Identifies the line-stacking strategy property, which is not applied during Spreadsheet text measurement.
public static RadProperty LineStackingStrategyProperty
Properties
Gets or sets the measured text baseline offset from the top of the block; painting uses it for line alignment.
public double BaselineOffset { get; set; }
Gets or sets the direction assigned to text created from the block's own text; inline runs carry their own direction.
public FlowDirection FlowDirection { get; set; }
Gets or sets the base font family used by block text and inline runs without their own family.
public FontFamily FontFamily { get; set; }
Gets or sets the block font size. Measurement assigns this size to each inline run.
public double FontSize { get; set; }
Gets or sets the block font style, which measurement applies to each inline run.
public FontStyle FontStyle { get; set; }
Gets or sets the default font weight used when the block creates a run from its own text and formatting.
public FontWeight FontWeight { get; set; }
Gets or sets the block foreground brush used when creating a run from the block's own text.
public Brush Foreground { get; set; }
Gets the inline runs. A non-empty collection takes precedence over Text during measurement and drawing.
public ItemNotifyCollection<Run> Inlines { get; }
Gets or sets the requested line height. This value is stored but is not used to calculate measured height.
public double LineHeight { get; set; }
Gets or sets the line-height strategy; it does not affect measured height in this implementation.
public LineStackingStrategy LineStackingStrategy { get; set; }
Gets or sets padding that is included in the measured block size.
public override Padding Padding { get; set; }
Overrides:
Gets or sets whether text created from the block's own properties is struck through.
public bool Strikeout { get; set; }
Gets or sets unformatted text. When Inlines contains runs, those runs are measured and drawn instead.
public override string Text { get; set; }
Overrides:
Gets or sets horizontal alignment. Left, center, and right are supported; Justify is rendered left-aligned.
public TextAlignment TextAlignment { get; set; }
Gets or sets whether drawing wraps text within the block bounds. Measurement does not account for wrapping.
public TextWrapping TextWrapping { get; set; }
Methods
Draws inline runs with the native GDI renderer for unrotated screen rendering.
protected virtual void DrawGdi(float angle, Graphics nativeGraphics, float fontSizeScale)
The current element rotation angle; this path is selected when it is zero.
nativeGraphicsGraphicsThe graphics surface used to draw the runs.
fontSizeScalefloatThe scale applied to run font sizes.
Draws inline runs with GDI+ when the element is rotated or rendered as a bitmap.
Measures the text runs and adds block padding to the resulting size. The available width is not used for wrap-aware measurement.
Paints the measured runs, selecting GDI for unrotated screen rendering and GDI+ for rotated or bitmap rendering.
Returns the literal string TextBlock{0}; the current format string does not include the block's text.