HyperlinkTextBlock Class
A Avalonia.Controls.TextBlock implementation that renders like a hyperlink and supports being clicked.
[PseudoClasses(new string[] { ":pressed" })]
public class HyperlinkTextBlock : TextBlock, IDataContextProvider, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, ILogical, ICommandSource
- Inheritance:
- object AvaloniaObject Animatable StyledElement Visual Layoutable Interactive InputElement Control TextBlock object
- Implements:
- IDataContextProvider IThemeVariantHost IResourceHost IResourceNode IStyleHost ISetLogicalParent ISetInheritanceParent IStyleable INamed IInputElement IDataTemplateHost ISetterValue ILogical ICommandSource
Constructors
HyperlinkTextBlock()
Initializes an instance of the class.
public HyperlinkTextBlock()
Properties
Command
The ICommand to be invoked when the hyperlink is clicked.
CommandParameter
The parameter to be passed to the Command.
IsEnabledCore
Allows a derived class to override the enabled state of the control.
protected override bool IsEnabledCore { get; }
Property Value
Remarks
Derived controls may wish to disable the enabled state of the control without overwriting the user-supplied Avalonia.Input.InputElement.IsEnabled setting. This can be done by overriding this property to return the overridden enabled state. If the value returned from Avalonia.Input.InputElement.IsEnabledCore should change, then the derived control should call Avalonia.Input.InputElement.UpdateIsEffectivelyEnabled().
IsPressed
Whether the hyperlink is currently pressed.
Methods
OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)
Called when the styled element is added to a rooted logical tree.
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
Parameter | Type | Description |
---|---|---|
e | LogicalTreeAttachmentEventArgs | The event args. |
OnClick()
Raises the Click event.
protected virtual void OnClick()
OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)
Called when the styled element is removed from a rooted logical tree.
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
Parameter | Type | Description |
---|---|---|
e | LogicalTreeAttachmentEventArgs | The event args. |
OnKeyDown(KeyEventArgs)
Called before the Avalonia.Input.InputElement.KeyDown event occurs.
protected override void OnKeyDown(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyEventArgs | The event args. |
OnKeyUp(KeyEventArgs)
Called before the Avalonia.Input.InputElement.KeyUp event occurs.
protected override void OnKeyUp(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyEventArgs | The event args. |
OnLostFocus(RoutedEventArgs)
Called before the Avalonia.Input.InputElement.LostFocus event occurs.
protected override void OnLostFocus(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | The event args. |
OnPointerCaptureLost(PointerCaptureLostEventArgs)
Called before the Avalonia.Input.InputElement.PointerCaptureLost event occurs.
protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e)
Parameter | Type | Description |
---|---|---|
e | PointerCaptureLostEventArgs | The event args. |
OnPointerPressed(PointerPressedEventArgs)
Called before the Avalonia.Input.InputElement.PointerPressed event occurs.
protected override void OnPointerPressed(PointerPressedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | PointerPressedEventArgs | The event args. |
OnPointerReleased(PointerReleasedEventArgs)
Called before the Avalonia.Input.InputElement.PointerReleased event occurs.
protected override void OnPointerReleased(PointerReleasedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | PointerReleasedEventArgs | The event args. |
UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception?)
Called to update the validation state for properties for which data validation is enabled.
protected override void UpdateDataValidation(AvaloniaProperty property, BindingValueType state, Exception? error)
Parameter | Type | Description |
---|---|---|
property | AvaloniaProperty | The property. |
state | BindingValueType | The current data binding state. |
error | Exception | The current data binding error, if any. |
Events
Click
Raised when the hyperlink is clicked.
Fields
ClickEvent
Defines the Click event.
public static readonly RoutedEvent<RoutedEventArgs> ClickEvent
CommandParameterProperty
Defines the CommandParameter property.
public static readonly StyledProperty<object?> CommandParameterProperty
CommandProperty
Defines the Command property.
public static readonly StyledProperty<ICommand?> CommandProperty
IsPressedProperty
Defines the IsPressed property.
public static readonly DirectProperty<HyperlinkTextBlock, bool> IsPressedProperty
Inherited Members
- TextBlock.BackgroundProperty
- TextBlock.PaddingProperty
- TextBlock.FontFamilyProperty
- TextBlock.FontSizeProperty
- TextBlock.FontStyleProperty
- TextBlock.FontWeightProperty
- TextBlock.FontStretchProperty
- TextBlock.ForegroundProperty
- TextBlock.BaselineOffsetProperty
- TextBlock.LineHeightProperty
- TextBlock.LineSpacingProperty
- TextBlock.LetterSpacingProperty
- TextBlock.MaxLinesProperty
- TextBlock.TextProperty
- TextBlock.TextAlignmentProperty
- TextBlock.TextWrappingProperty
- TextBlock.TextTrimmingProperty
- TextBlock.TextDecorationsProperty
- TextBlock.FontFeaturesProperty
- TextBlock.InlinesProperty
- TextBlock._constraint
- TextBlock._textRuns
- TextBlock.GetBaselineOffset(Control)
- TextBlock.SetBaselineOffset(Control, double)
- 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.SetLineHeight(Control, double)
- TextBlock.GetLetterSpacing(Control)
- TextBlock.SetLetterSpacing(Control, double)
- TextBlock.GetMaxLines(Control)
- TextBlock.SetMaxLines(Control, int)
- TextBlock.Render(DrawingContext)
- TextBlock.RenderTextLayout(DrawingContext, Point)
- TextBlock.CreateTextLayout(string)
- TextBlock.InvalidateTextLayout()
- TextBlock.OnMeasureInvalidated()
- TextBlock.MeasureOverride(Size)
- TextBlock.ArrangeOverride(Size)
- TextBlock.OnCreateAutomationPeer()
- TextBlock.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
- TextBlock.TextLayout
- TextBlock.Padding
- TextBlock.Background
- TextBlock.Text
- TextBlock.FontFamily
- TextBlock.FontSize
- TextBlock.FontStyle
- TextBlock.FontWeight
- TextBlock.FontStretch
- TextBlock.Foreground
- TextBlock.LineHeight
- TextBlock.LineSpacing
- TextBlock.LetterSpacing
- TextBlock.MaxLines
- TextBlock.TextWrapping
- TextBlock.TextTrimming
- TextBlock.TextAlignment
- TextBlock.TextDecorations
- TextBlock.FontFeatures
- TextBlock.Inlines
- TextBlock.BypassFlowDirectionPolicies
- TextBlock.BaselineOffset
- Control.FocusAdornerProperty
- Control.TagProperty
- Control.ContextMenuProperty
- Control.ContextFlyoutProperty
- Control.RequestBringIntoViewEvent
- Control.ContextRequestedEvent
- Control.LoadedEvent
- Control.UnloadedEvent
- Control.SizeChangedEvent
- Control.GetTemplateFocusTarget()
- Control.OnLoaded(RoutedEventArgs)
- Control.OnUnloaded(RoutedEventArgs)
- Control.OnSizeChanged(SizeChangedEventArgs)
- Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)
- Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)
- Control.OnGotFocus(GotFocusEventArgs)
- Control.FocusAdorner
- Control.DataTemplates
- Control.ContextMenu
- Control.ContextFlyout
- Control.IsLoaded
- Control.Tag
- Control.ContextRequested
- Control.Loaded
- Control.Unloaded
- Control.SizeChanged
- InputElement.FocusableProperty
- InputElement.IsEnabledProperty
- InputElement.IsEffectivelyEnabledProperty
- InputElement.CursorProperty
- InputElement.IsKeyboardFocusWithinProperty
- InputElement.IsFocusedProperty
- InputElement.IsHitTestVisibleProperty
- InputElement.IsPointerOverProperty
- InputElement.IsTabStopProperty
- InputElement.GotFocusEvent
- InputElement.LostFocusEvent
- InputElement.KeyDownEvent
- InputElement.KeyUpEvent
- InputElement.TabIndexProperty
- InputElement.TextInputEvent
- InputElement.TextInputMethodClientRequestedEvent
- InputElement.PointerEnteredEvent
- InputElement.PointerExitedEvent
- InputElement.PointerMovedEvent
- InputElement.PointerPressedEvent
- InputElement.PointerReleasedEvent
- InputElement.PointerCaptureLostEvent
- InputElement.PointerWheelChangedEvent
- InputElement.TappedEvent
- InputElement.HoldingEvent
- InputElement.DoubleTappedEvent
- InputElement.Focus(NavigationMethod, KeyModifiers)
- InputElement.OnTextInput(TextInputEventArgs)
- InputElement.OnPointerEntered(PointerEventArgs)
- InputElement.OnPointerExited(PointerEventArgs)
- InputElement.OnPointerMoved(PointerEventArgs)
- InputElement.OnPointerWheelChanged(PointerWheelEventArgs)
- InputElement.UpdateIsEffectivelyEnabled()
- InputElement.Focusable
- InputElement.IsEnabled
- InputElement.Cursor
- InputElement.IsKeyboardFocusWithin
- InputElement.IsFocused
- InputElement.IsHitTestVisible
- InputElement.IsPointerOver
- InputElement.IsTabStop
- InputElement.IsEffectivelyEnabled
- InputElement.TabIndex
- InputElement.KeyBindings
- InputElement.GestureRecognizers
- InputElement.GotFocus
- InputElement.LostFocus
- InputElement.KeyDown
- InputElement.KeyUp
- InputElement.TextInput
- InputElement.TextInputMethodClientRequested
- InputElement.PointerEntered
- InputElement.PointerExited
- InputElement.PointerMoved
- InputElement.PointerPressed
- InputElement.PointerReleased
- InputElement.PointerCaptureLost
- InputElement.PointerWheelChanged
- InputElement.Tapped
- InputElement.Holding
- InputElement.DoubleTapped
- Interactive.AddHandler(RoutedEvent, Delegate, RoutingStrategies, bool)
- Interactive.AddHandler<TEventArgs>(RoutedEvent<TEventArgs>, EventHandler<TEventArgs>, RoutingStrategies, bool)
- Interactive.RemoveHandler(RoutedEvent, Delegate)
- Interactive.RemoveHandler<TEventArgs>(RoutedEvent<TEventArgs>, EventHandler<TEventArgs>)
- Interactive.RaiseEvent(RoutedEventArgs)
- Interactive.BuildEventRoute(RoutedEvent)
- Layoutable.DesiredSizeProperty
- Layoutable.WidthProperty
- Layoutable.HeightProperty
- Layoutable.MinWidthProperty
- Layoutable.MaxWidthProperty
- Layoutable.MinHeightProperty
- Layoutable.MaxHeightProperty
- Layoutable.MarginProperty
- Layoutable.HorizontalAlignmentProperty
- Layoutable.VerticalAlignmentProperty
- Layoutable.UseLayoutRoundingProperty
- Layoutable.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.Width
- Layoutable.Height
- Layoutable.MinWidth
- Layoutable.MaxWidth
- Layoutable.MinHeight
- Layoutable.MaxHeight
- Layoutable.Margin
- Layoutable.HorizontalAlignment
- Layoutable.VerticalAlignment
- Layoutable.DesiredSize
- Layoutable.IsMeasureValid
- Layoutable.IsArrangeValid
- Layoutable.UseLayoutRounding
- Layoutable.EffectiveViewportChanged
- Layoutable.LayoutUpdated
- Visual.BoundsProperty
- Visual.ClipToBoundsProperty
- Visual.ClipProperty
- Visual.IsVisibleProperty
- Visual.OpacityProperty
- Visual.OpacityMaskProperty
- Visual.EffectProperty
- Visual.HasMirrorTransformProperty
- Visual.RenderTransformProperty
- Visual.RenderTransformOriginProperty
- Visual.FlowDirectionProperty
- Visual.VisualParentProperty
- Visual.ZIndexProperty
- Visual.GetFlowDirection(Visual)
- Visual.SetFlowDirection(Visual, FlowDirection)
- Visual.InvalidateVisual()
- Visual.AffectsRender<T>(params AvaloniaProperty[])
- Visual.LogicalChildrenCollectionChanged(object, NotifyCollectionChangedEventArgs)
- Visual.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
- Visual.OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
- Visual.InvalidateMirrorTransform()
- Visual.Bounds
- Visual.ClipToBounds
- Visual.Clip
- Visual.IsEffectivelyVisible
- Visual.IsVisible
- Visual.Opacity
- Visual.OpacityMask
- Visual.Effect
- Visual.HasMirrorTransform
- Visual.RenderTransform
- Visual.RenderTransformOrigin
- Visual.FlowDirection
- Visual.ZIndex
- Visual.VisualChildren
- Visual.VisualRoot
- Visual.AttachedToVisualTree
- Visual.DetachedFromVisualTree
- StyledElement.DataContextProperty
- StyledElement.NameProperty
- StyledElement.ParentProperty
- StyledElement.TemplatedParentProperty
- StyledElement.ThemeProperty
- StyledElement.BeginInit()
- StyledElement.EndInit()
- StyledElement.ApplyStyling()
- StyledElement.InitializeIfNeeded()
- StyledElement.TryGetResource(object, ThemeVariant, out object)
- StyledElement.OnDataContextChanged(EventArgs)
- StyledElement.OnDataContextBeginUpdate()
- StyledElement.OnDataContextEndUpdate()
- StyledElement.OnInitialized()
- StyledElement.Name
- StyledElement.Classes
- StyledElement.DataContext
- StyledElement.IsInitialized
- StyledElement.Styles
- StyledElement.StyleKey
- StyledElement.Resources
- StyledElement.TemplatedParent
- StyledElement.Theme
- StyledElement.LogicalChildren
- StyledElement.PseudoClasses
- StyledElement.StyleKeyOverride
- StyledElement.Parent
- StyledElement.ActualThemeVariant
- StyledElement.AttachedToLogicalTree
- StyledElement.DetachedFromLogicalTree
- StyledElement.DataContextChanged
- StyledElement.Initialized
- StyledElement.ResourcesChanged
- StyledElement.ActualThemeVariantChanged
- Animatable.TransitionsProperty
- Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)
- Animatable.Transitions
- AvaloniaObject.CheckAccess()
- AvaloniaObject.VerifyAccess()
- AvaloniaObject.ClearValue(AvaloniaProperty)
- AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)
- AvaloniaObject.ClearValue<T>(StyledProperty<T>)
- AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)
- AvaloniaObject.Equals(object)
- 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(AvaloniaProperty, object, BindingPriority)
- AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)
- AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)
- AvaloniaObject.SetCurrentValue(AvaloniaProperty, object)
- AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)
- AvaloniaObject.Bind(AvaloniaProperty, IBinding)
- AvaloniaObject.Bind(AvaloniaProperty, IObservable<object>, BindingPriority)
- AvaloniaObject.Bind<T>(StyledProperty<T>, IObservable<object>, BindingPriority)
- AvaloniaObject.Bind<T>(StyledProperty<T>, IObservable<T>, BindingPriority)
- AvaloniaObject.Bind<T>(StyledProperty<T>, IObservable<BindingValue<T>>, BindingPriority)
- AvaloniaObject.Bind<T>(DirectPropertyBase<T>, IObservable<object>)
- AvaloniaObject.Bind<T>(DirectPropertyBase<T>, IObservable<T>)
- AvaloniaObject.Bind<T>(DirectPropertyBase<T>, IObservable<BindingValue<T>>)
- AvaloniaObject.CoerceValue(AvaloniaProperty)
- AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)
- AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)
- AvaloniaObject.InheritanceParent
- AvaloniaObject.this[AvaloniaProperty]
- AvaloniaObject.this[IndexerDescriptor]
- AvaloniaObject.PropertyChanged
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
Extension Methods
- AvaloniaObjectExtensions.BindToProperty(AvaloniaObject, AvaloniaProperty, AvaloniaObject, AvaloniaProperty, BindingMode)
- AvaloniaObjectExtensions.BindToProperty(AvaloniaObject, AvaloniaProperty, object, AvaloniaProperty, BindingMode, IValueConverter, object)
- VisualExtensions.GetFirstFocusableVisualDescendant(Visual)
- VisualExtensions.InvalidateMeasureForAllVisualsInSameTemplate(Visual)
- VisualExtensions.InvalidateMeasureForVisualAncestorPath<PathEndType>(Visual, bool)
- ObjectExtensions.TryConvertToDouble(object, out double)
- ObjectExtensions.TryConvertToDouble(object, IFormatProvider, out double)