Class TextBlock
- Namespace
- CarinaStudio.Controls
- Assembly
- CarinaStudio.AppBase.Avalonia.dll
Extended Avalonia.Controls.TextBlock.
public class TextBlock : TextBlock, INotifyPropertyChanged, IDataContextProvider, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, IInputElement, IDataTemplateHost, INamed, ISetterValue, ILogical
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTextBlockTextBlock
- Implements
-
IDataContextProviderIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentIStyleableIInputElementIDataTemplateHostINamedISetterValueILogical
- Derived
- Inherited Members
-
TextBlock.BackgroundPropertyTextBlock.PaddingPropertyTextBlock.FontFamilyPropertyTextBlock.FontSizePropertyTextBlock.FontStylePropertyTextBlock.FontWeightPropertyTextBlock.FontStretchPropertyTextBlock.ForegroundPropertyTextBlock.BaselineOffsetPropertyTextBlock.LineHeightPropertyTextBlock.LineSpacingPropertyTextBlock.LetterSpacingPropertyTextBlock.MaxLinesPropertyTextBlock.TextPropertyTextBlock.TextAlignmentPropertyTextBlock.TextWrappingPropertyTextBlock.TextTrimmingPropertyTextBlock.TextDecorationsPropertyTextBlock.InlinesPropertyTextBlock.GetBaselineOffset(Control)TextBlock.GetTextAlignment(Control)TextBlock.SetTextAlignment(Control, TextAlignment)TextBlock.GetTextWrapping(Control)TextBlock.SetTextWrapping(Control, TextWrapping)TextBlock.GetTextTrimming(Control)TextBlock.SetTextTrimming(Control, TextTrimming)TextBlock.GetLineHeight(Control)TextBlock.GetLetterSpacing(Control)TextBlock.GetMaxLines(Control)TextBlock.Render(DrawingContext)TextBlock.RenderTextLayout(DrawingContext, Point)TextBlock.InvalidateTextLayout()TextBlock.OnMeasureInvalidated()TextBlock.ArrangeOverride(Size)TextBlock.OnCreateAutomationPeer()TextBlock.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)TextBlock.TextLayoutTextBlock.PaddingTextBlock.BackgroundTextBlock.TextTextBlock.FontFamilyTextBlock.FontSizeTextBlock.FontStyleTextBlock.FontWeightTextBlock.FontStretchTextBlock.ForegroundTextBlock.LineHeightTextBlock.LineSpacingTextBlock.LetterSpacingTextBlock.MaxLinesTextBlock.TextWrappingTextBlock.TextTrimmingTextBlock.TextAlignmentTextBlock.TextDecorationsTextBlock.InlinesTextBlock.BypassFlowDirectionPoliciesTextBlock.BaselineOffsetControl.FocusAdornerPropertyControl.TagPropertyControl.ContextMenuPropertyControl.ContextFlyoutPropertyControl.RequestBringIntoViewEventControl.ContextRequestedEventControl.LoadedEventControl.UnloadedEventControl.SizeChangedEventControl.GetTemplateFocusTarget()Control.OnLoaded(RoutedEventArgs)Control.OnUnloaded(RoutedEventArgs)Control.OnSizeChanged(SizeChangedEventArgs)Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnGotFocus(GotFocusEventArgs)Control.OnLostFocus(RoutedEventArgs)Control.OnPointerReleased(PointerReleasedEventArgs)Control.OnKeyUp(KeyEventArgs)Control.FocusAdornerControl.DataTemplatesControl.ContextMenuControl.ContextFlyoutControl.IsLoadedControl.TagControl.ContextRequestedControl.LoadedControl.UnloadedControl.SizeChangedInputElement.FocusablePropertyInputElement.IsEnabledPropertyInputElement.IsEffectivelyEnabledPropertyInputElement.CursorPropertyInputElement.IsKeyboardFocusWithinPropertyInputElement.IsFocusedPropertyInputElement.IsHitTestVisiblePropertyInputElement.IsPointerOverPropertyInputElement.IsTabStopPropertyInputElement.GotFocusEventInputElement.LostFocusEventInputElement.KeyDownEventInputElement.KeyUpEventInputElement.TabIndexPropertyInputElement.TextInputEventInputElement.TextInputMethodClientRequestedEventInputElement.PointerEnteredEventInputElement.PointerExitedEventInputElement.PointerMovedEventInputElement.PointerPressedEventInputElement.PointerReleasedEventInputElement.PointerCaptureLostEventInputElement.PointerWheelChangedEventInputElement.TappedEventInputElement.HoldingEventInputElement.DoubleTappedEventInputElement.Focus(NavigationMethod, KeyModifiers)InputElement.OnKeyDown(KeyEventArgs)InputElement.OnTextInput(TextInputEventArgs)InputElement.OnPointerEntered(PointerEventArgs)InputElement.OnPointerExited(PointerEventArgs)InputElement.OnPointerMoved(PointerEventArgs)InputElement.OnPointerPressed(PointerPressedEventArgs)InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)InputElement.OnPointerWheelChanged(PointerWheelEventArgs)InputElement.UpdateIsEffectivelyEnabled()InputElement.FocusableInputElement.IsEnabledInputElement.CursorInputElement.IsKeyboardFocusWithinInputElement.IsFocusedInputElement.IsHitTestVisibleInputElement.IsPointerOverInputElement.IsTabStopInputElement.IsEffectivelyEnabledInputElement.TabIndexInputElement.KeyBindingsInputElement.IsEnabledCoreInputElement.GestureRecognizersInputElement.GotFocusInputElement.LostFocusInputElement.KeyDownInputElement.KeyUpInputElement.TextInputInputElement.TextInputMethodClientRequestedInputElement.PointerEnteredInputElement.PointerExitedInputElement.PointerMovedInputElement.PointerPressedInputElement.PointerReleasedInputElement.PointerCaptureLostInputElement.PointerWheelChangedInputElement.TappedInputElement.HoldingInputElement.DoubleTappedInteractive.RaiseEvent(RoutedEventArgs)Interactive.BuildEventRoute(RoutedEvent)Layoutable.DesiredSizePropertyLayoutable.WidthPropertyLayoutable.HeightPropertyLayoutable.MinWidthPropertyLayoutable.MaxWidthPropertyLayoutable.MinHeightPropertyLayoutable.MaxHeightPropertyLayoutable.MarginPropertyLayoutable.HorizontalAlignmentPropertyLayoutable.VerticalAlignmentPropertyLayoutable.UseLayoutRoundingPropertyLayoutable.UpdateLayout()Layoutable.ApplyTemplate()Layoutable.Measure(Size)Layoutable.Arrange(Rect)Layoutable.InvalidateMeasure()Layoutable.InvalidateArrange()Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])Layoutable.AffectsArrange<T>(params AvaloniaProperty[])Layoutable.MeasureCore(Size)Layoutable.ArrangeCore(Rect)Layoutable.OnVisualParentChanged(Visual, Visual)Layoutable.WidthLayoutable.HeightLayoutable.MinWidthLayoutable.MaxWidthLayoutable.MinHeightLayoutable.MaxHeightLayoutable.MarginLayoutable.HorizontalAlignmentLayoutable.VerticalAlignmentLayoutable.DesiredSizeLayoutable.IsMeasureValidLayoutable.IsArrangeValidLayoutable.UseLayoutRoundingLayoutable.EffectiveViewportChangedLayoutable.LayoutUpdatedVisual.BoundsPropertyVisual.ClipToBoundsPropertyVisual.ClipPropertyVisual.IsVisiblePropertyVisual.OpacityPropertyVisual.OpacityMaskPropertyVisual.EffectPropertyVisual.HasMirrorTransformPropertyVisual.RenderTransformPropertyVisual.RenderTransformOriginPropertyVisual.FlowDirectionPropertyVisual.VisualParentPropertyVisual.ZIndexPropertyVisual.GetFlowDirection(Visual)Visual.SetFlowDirection(Visual, FlowDirection)Visual.InvalidateVisual()Visual.AffectsRender<T>(params AvaloniaProperty[])Visual.InvalidateMirrorTransform()Visual.BoundsVisual.ClipToBoundsVisual.ClipVisual.IsEffectivelyVisibleVisual.IsVisibleVisual.OpacityVisual.OpacityMaskVisual.EffectVisual.HasMirrorTransformVisual.RenderTransformVisual.RenderTransformOriginVisual.FlowDirectionVisual.ZIndexVisual.VisualChildrenVisual.VisualRootVisual.AttachedToVisualTreeVisual.DetachedFromVisualTreeStyledElement.DataContextPropertyStyledElement.NamePropertyStyledElement.ParentPropertyStyledElement.TemplatedParentPropertyStyledElement.ThemePropertyStyledElement.BeginInit()StyledElement.EndInit()StyledElement.ApplyStyling()StyledElement.InitializeIfNeeded()StyledElement.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)StyledElement.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)StyledElement.OnDataContextBeginUpdate()StyledElement.OnDataContextEndUpdate()StyledElement.OnInitialized()StyledElement.NameStyledElement.ClassesStyledElement.DataContextStyledElement.IsInitializedStyledElement.StylesStyledElement.StyleKeyStyledElement.ResourcesStyledElement.TemplatedParentStyledElement.ThemeStyledElement.LogicalChildrenStyledElement.PseudoClassesStyledElement.ParentStyledElement.ActualThemeVariantStyledElement.AttachedToLogicalTreeStyledElement.DetachedFromLogicalTreeStyledElement.DataContextChangedStyledElement.InitializedStyledElement.ResourcesChangedStyledElement.ActualThemeVariantChangedAnimatable.TransitionsPropertyAnimatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)Animatable.TransitionsAvaloniaObject.CheckAccess()AvaloniaObject.VerifyAccess()AvaloniaObject.ClearValue(AvaloniaProperty)AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)AvaloniaObject.ClearValue<T>(StyledProperty<T>)AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetHashCode()AvaloniaObject.GetValue(AvaloniaProperty)AvaloniaObject.GetValue<T>(StyledProperty<T>)AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)AvaloniaObject.IsAnimating(AvaloniaProperty)AvaloniaObject.IsSet(AvaloniaProperty)AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)AvaloniaObject.CoerceValue(AvaloniaProperty)AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)AvaloniaObject.InheritanceParentAvaloniaObject.this[AvaloniaProperty]AvaloniaObject.this[IndexerDescriptor]AvaloniaObject.PropertyChanged
- Extension Methods
Constructors
TextBlock()
Initialize new TextBlock instance.
public TextBlock()
Fields
IsMultiLineTextProperty
Property of IsMultiLineText.
public static readonly DirectProperty<TextBlock, bool> IsMultiLineTextProperty
Field Value
IsTextTrimmedProperty
Property of IsTextTrimmed.
public static readonly DirectProperty<TextBlock, bool> IsTextTrimmedProperty
Field Value
ShowToolTipWhenTextTrimmedProperty
Property of ShowToolTipWhenTextTrimmed.
public static readonly StyledProperty<bool> ShowToolTipWhenTextTrimmedProperty
Field Value
- StyledProperty<bool>
ToolTipTemplateProperty
Property of ToolTipTemplate.
public static readonly StyledProperty<IDataTemplate?> ToolTipTemplateProperty
Field Value
- StyledProperty<IDataTemplate>
Properties
DebugLogger
Get or set logger for debugging purpose.
public ILogger? DebugLogger { get; set; }
Property Value
IsMultiLineText
Check whether text inside the TextBlock has multiple lines or not.
public bool IsMultiLineText { get; }
Property Value
IsTextTrimmed
Check whether text inside the TextBlock has been trimmed or not.
public bool IsTextTrimmed { get; protected set; }
Property Value
ShowToolTipWhenTextTrimmed
Get or set whether tooltip is needed to be shown if text inside the control has been trimmed or not.
public bool ShowToolTipWhenTextTrimmed { get; set; }
Property Value
StyleKeyOverride
Gets the type by which the element is styled.
protected override Type StyleKeyOverride { get; }
Property Value
Remarks
Usually controls are styled by their own type, but there are instances where you want an element to be styled by its base type, e.g. creating SpecialButton that derives from Button and adds extra functionality but is still styled as a regular Button. Override this property to change the style for a control class, returning the type that you wish the elements to be styled as.
ToolTipTemplate
Get or set template for building tooltip.
public IDataTemplate? ToolTipTemplate { get; set; }
Property Value
- IDataTemplate
Methods
MeasureOverride(Size)
Measures the control and its child elements as part of a layout pass.
protected override Size MeasureOverride(Size availableSize)
Parameters
availableSizeSizeThe size available to the control.
Returns
- Size
The desired size for the control.
OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
Called when the control is added to a rooted visual tree.
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
Parameters
eVisualTreeAttachmentEventArgsThe event args.
OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
Called when the control is removed from a rooted visual tree.
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
Parameters
eVisualTreeAttachmentEventArgsThe event args.