Show / Hide Table of Contents

    Class Label

    Forms9Patch.Label

    Inheritance
    Object
    BindableObject
    Element
    NavigableElement
    VisualElement
    View
    Label
    Label
    Implements
    INotifyPropertyChanged
    IAnimatable
    ITabStopElement
    IViewController
    IVisualElementController
    IElementController
    IGestureController
    IGestureRecognizers
    IElementConfiguration<Label>
    IDecorableTextElement
    ILabel
    ILabelStyle
    IFontElement
    IElement
    Inherited Members
    Label.HorizontalTextAlignmentProperty
    Label.VerticalTextAlignmentProperty
    Label.TextColorProperty
    Label.CharacterSpacingProperty
    Label.FontProperty
    Label.TextProperty
    Label.FontFamilyProperty
    Label.FontSizeProperty
    Label.FontAttributesProperty
    Label.TextTransformProperty
    Label.TextDecorationsProperty
    Label.FormattedTextProperty
    Label.LineBreakModeProperty
    Label.LineHeightProperty
    Label.MaxLinesProperty
    Label.PaddingProperty
    Label.TextTypeProperty
    Label.UpdateFormsText(String, TextTransform)
    Label.OnBindingContextChanged()
    Label.On<T>()
    Label.GetChildElements(Point)
    Label.TextTransform
    Label.FormattedText
    Label.HorizontalTextAlignment
    Label.LineBreakMode
    Label.Text
    Label.TextColor
    Label.CharacterSpacing
    Label.VerticalTextAlignment
    Label.FontAttributes
    Label.TextDecorations
    Label.FontFamily
    Label.FontSize
    Label.LineHeight
    Label.MaxLines
    Label.Padding
    Label.TextType
    View.VerticalOptionsProperty
    View.HorizontalOptionsProperty
    View.MarginProperty
    View.GestureController
    View.GestureRecognizers
    View.IGestureController.CompositeGestureRecognizers
    View.HorizontalOptions
    View.Margin
    View.VerticalOptions
    VisualElement.NavigationProperty
    VisualElement.StyleProperty
    VisualElement.InputTransparentProperty
    VisualElement.IsEnabledProperty
    VisualElement.XProperty
    VisualElement.YProperty
    VisualElement.AnchorXProperty
    VisualElement.AnchorYProperty
    VisualElement.TranslationXProperty
    VisualElement.TranslationYProperty
    VisualElement.WidthProperty
    VisualElement.HeightProperty
    VisualElement.RotationProperty
    VisualElement.RotationXProperty
    VisualElement.RotationYProperty
    VisualElement.ScaleProperty
    VisualElement.ScaleXProperty
    VisualElement.ScaleYProperty
    VisualElement.ClipProperty
    VisualElement.VisualProperty
    VisualElement.IsVisibleProperty
    VisualElement.OpacityProperty
    VisualElement.BackgroundColorProperty
    VisualElement.BackgroundProperty
    VisualElement.BehaviorsProperty
    VisualElement.TriggersProperty
    VisualElement.WidthRequestProperty
    VisualElement.HeightRequestProperty
    VisualElement.MinimumWidthRequestProperty
    VisualElement.MinimumHeightRequestProperty
    VisualElement.IsFocusedProperty
    VisualElement.FlowDirectionProperty
    VisualElement.TabIndexProperty
    VisualElement.IsTabStopProperty
    VisualElement.OnTabIndexPropertyChanged(Int32, Int32)
    VisualElement.TabIndexDefaultValueCreator()
    VisualElement.OnTabStopPropertyChanged(Boolean, Boolean)
    VisualElement.TabStopDefaultValueCreator()
    VisualElement.BatchBegin()
    VisualElement.BatchCommit()
    VisualElement.Focus()
    VisualElement.Layout(Rectangle)
    VisualElement.Measure(Double, Double, MeasureFlags)
    VisualElement.Unfocus()
    VisualElement.InvalidateMeasure()
    VisualElement.OnChildAdded(Element)
    VisualElement.OnChildRemoved(Element)
    Xamarin.Forms.VisualElement.OnChildRemoved(Xamarin.Forms.Element, System.Int32)
    VisualElement.OnChildrenReordered()
    VisualElement.SizeAllocated(Double, Double)
    VisualElement.IVisualElementController.InvalidateMeasure(InvalidationTrigger)
    VisualElement.ChangeVisualState()
    VisualElement.Visual
    VisualElement.FlowDirection
    VisualElement.IVisualElementController.EffectiveFlowDirection
    VisualElement.AnchorX
    VisualElement.AnchorY
    VisualElement.BackgroundColor
    VisualElement.Background
    VisualElement.Behaviors
    VisualElement.Bounds
    VisualElement.Height
    VisualElement.HeightRequest
    VisualElement.InputTransparent
    VisualElement.IsEnabled
    VisualElement.IsFocused
    VisualElement.IsVisible
    VisualElement.MinimumHeightRequest
    VisualElement.MinimumWidthRequest
    VisualElement.Opacity
    VisualElement.Rotation
    VisualElement.RotationX
    VisualElement.RotationY
    VisualElement.Scale
    VisualElement.ScaleX
    VisualElement.ScaleY
    VisualElement.TabIndex
    VisualElement.IsTabStop
    VisualElement.TranslationX
    VisualElement.TranslationY
    VisualElement.Triggers
    VisualElement.Width
    VisualElement.WidthRequest
    VisualElement.X
    VisualElement.Y
    VisualElement.Clip
    VisualElement.Resources
    VisualElement.ChildrenReordered
    VisualElement.Focused
    VisualElement.MeasureInvalidated
    VisualElement.SizeChanged
    VisualElement.Unfocused
    NavigableElement.OnParentSet()
    NavigableElement.Navigation
    NavigableElement.Style
    NavigableElement.StyleClass
    NavigableElement.class
    Element.MenuProperty
    Element.AutomationIdProperty
    Element.ClassIdProperty
    Element.GetMenu(BindableObject)
    Element.SetMenu(BindableObject, Menu)
    Element.IElementController.SetValueFromRenderer(BindableProperty, Object)
    Element.FindByName(String)
    Element.RemoveDynamicResource(BindableProperty)
    Element.SetDynamicResource(BindableProperty, String)
    Element.AutomationId
    Element.ClassId
    Element.Effects
    Element.Id
    Element.StyleId
    Element.Parent
    Element.ChildAdded
    Element.ChildRemoved
    Element.DescendantAdded
    Element.DescendantRemoved
    BindableObject.BindingContextProperty
    BindableObject.ClearValue(BindableProperty)
    BindableObject.ClearValue(BindablePropertyKey)
    BindableObject.GetValue(BindableProperty)
    BindableObject.IsSet(BindableProperty)
    BindableObject.RemoveBinding(BindableProperty)
    BindableObject.SetBinding(BindableProperty, BindingBase)
    BindableObject.ApplyBindings()
    BindableObject.OnPropertyChanging(String)
    BindableObject.UnapplyBindings()
    BindableObject.SetValue(BindableProperty, Object)
    BindableObject.SetValue(BindablePropertyKey, Object)
    BindableObject.CoerceValue(BindableProperty)
    BindableObject.CoerceValue(BindablePropertyKey)
    BindableObject.Dispatcher
    BindableObject.BindingContext
    BindableObject.PropertyChanged
    BindableObject.PropertyChanging
    BindableObject.BindingContextChanged
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Namespace: Forms9Patch
    Assembly: Forms9Patch.dll
    Syntax
    [ContentProperty("HtmlText")]
    public class Label : Label, INotifyPropertyChanged, IDynamicResourceHandler, IElement, INameScope, INavigationProxy, IStyleSelectable, IAnimatable, IResourcesProvider, IStyleElement, IFlowDirectionController, IPropertyPropagationController, IVisualController, ITabStopElement, IStylable, IViewController, IVisualElementController, IElementController, IGestureController, IGestureRecognizers, IFontElement, ITextElement, ITextAlignmentElement, ILineHeightElement, IElementConfiguration<Label>, IDecorableTextElement, IPaddingElement, ILabel, ILabelStyle, IFontElement, IElement

    Constructors

    Label()

    Initializes a new instance of the Label class.

    Declaration
    public Label()

    Label(String)

    Convenience constructor for Forms9Patch.Label instance

    Declaration
    public Label(string text)
    Parameters
    Type Name Description
    String text

    Fields

    ActualFontSizeProperty

    OBSOLETE: Use FittedFontSizeProperty instead

    Declaration
    [Obsolete("Use FittedFontSizeProperty instead.", true)]
    public static readonly BindableProperty ActualFontSizeProperty
    Field Value
    Type Description
    BindableProperty

    AutoFitProperty

    The backing store for the AutoFit property.

    Declaration
    public static readonly BindableProperty AutoFitProperty
    Field Value
    Type Description
    BindableProperty

    FitProperty

    backing store for Fit property

    Declaration
    [Obsolete("FitProperty is obsolete.  Use AutoFitProperty instead.")]
    public static readonly BindableProperty FitProperty
    Field Value
    Type Description
    BindableProperty

    FittedFontSizeProperty

    Backing store for the actual font size property after fitting.

    Declaration
    public static readonly BindableProperty FittedFontSizeProperty
    Field Value
    Type Description
    BindableProperty

    HtmlTextProperty

    Backing store for the formatted text property.

    Declaration
    public static readonly BindableProperty HtmlTextProperty
    Field Value
    Type Description
    BindableProperty

    IsDynamicallySizedProperty

    The backing store for fixed size property.

    Declaration
    public static readonly BindableProperty IsDynamicallySizedProperty
    Field Value
    Type Description
    BindableProperty

    LinesProperty

    The backing store for the lines property.

    Declaration
    public static readonly BindableProperty LinesProperty
    Field Value
    Type Description
    BindableProperty

    MinFontSizeProperty

    The backing store for the minimum font size property.

    Declaration
    public static readonly BindableProperty MinFontSizeProperty
    Field Value
    Type Description
    BindableProperty

    SynchronizedFontSizeProperty

    backing store for SynchronizedFontSize property

    Declaration
    public static readonly BindableProperty SynchronizedFontSizeProperty
    Field Value
    Type Description
    BindableProperty

    Properties

    ActualFontSize

    OBSOLETE: Use FittedFontSize property instead

    Declaration
    [Obsolete("Use FittedFontSize property instead.", true)]
    public double ActualFontSize { get; set; }
    Property Value
    Type Description
    Double

    AutoFit

    Gets or sets the fit method. Ignored if the Width and Height is not fixed by a parent, HeightRequest, and/or WidthRequest.

    Declaration
    public AutoFit AutoFit { get; set; }
    Property Value
    Type Description
    AutoFit

    The fit.

    DefaultFontSize

    The default size of labels rendered on the current platform

    Declaration
    public static double DefaultFontSize { get; }
    Property Value
    Type Description
    Double

    Fit

    Gets/Sets the Fit property

    Declaration
    [Obsolete("Fit property is obsolete.  Use AutoFit property instead.")]
    public LabelFit Fit { get; set; }
    Property Value
    Type Description
    LabelFit

    FittedFontSize

    Gets the actual size of the font (after fitting).

    Declaration
    public double FittedFontSize { get; }
    Property Value
    Type Description
    Double

    The actual size of the font.

    HtmlText

    Gets or sets the formatted text.

    Declaration
    public string HtmlText { get; set; }
    Property Value
    Type Description
    String

    The formatted text.

    InstanceId

    Incremental identity (starting at 0) of instance of this class

    Declaration
    public int InstanceId { get; }
    Property Value
    Type Description
    Int32

    IsDynamicallySized

    Gets if the size of the label has been fixed by a parent element, the HeightRequest and/or the WidthRequest properties.

    Declaration
    public bool IsDynamicallySized { get; }
    Property Value
    Type Description
    Boolean

    Is the label fixed in size.

    Lines

    Gets or sets the number of lines used in a fit. If zero and fit is not AutoFit.None or ignored, will maximize the font size to best width and height with minimum number of lines.

    Declaration
    public int Lines { get; set; }
    Property Value
    Type Description
    Int32

    The lines.

    MinFontSize

    Gets or sets the minimum size of the font allowed during an autofit.

    Declaration
    public double MinFontSize { get; set; }
    Property Value
    Type Description
    Double

    The minimum size of the font. Default=4

    SynchronizedFontSize

    Gets/Sets the SynchronizedFontSize property

    Declaration
    public double SynchronizedFontSize { get; set; }
    Property Value
    Type Description
    Double

    Methods

    GetSizeRequest(Double, Double)

    Gets the size request.

    Declaration
    [Obsolete("Use OnMeasure")]
    public override SizeRequest GetSizeRequest(double widthConstraint, double heightConstraint)
    Parameters
    Type Name Description
    Double widthConstraint

    The available width that a parent element can allocated to a child. Value will be between 0 and double.PositiveInfinity.

    Double heightConstraint

    The available height that a parent element can allocated to a child. Value will be between 0 and double.PositiveInfinity.

    Returns
    Type Description
    SizeRequest

    The size request.

    Overrides
    VisualElement.GetSizeRequest(Double, Double)

    HardForceLayout()

    Because InvalidateMeasure doesn't always work

    Declaration
    public void HardForceLayout()

    IndexAtPoint(Point)

    Gets unmarked string index at touch point.

    Declaration
    public int IndexAtPoint(Point point)
    Parameters
    Type Name Description
    Point point

    Point.

    Returns
    Type Description
    Int32

    The at point.

    OnMeasure(Double, Double)

    Funny you asked!

    Declaration
    protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
    Parameters
    Type Name Description
    Double widthConstraint
    Double heightConstraint
    Returns
    Type Description
    SizeRequest
    Overrides
    VisualElement.OnMeasure(Double, Double)

    OnPropertyChanged(String)

    Ons the property changed.

    Declaration
    protected override void OnPropertyChanged(string propertyName = null)
    Parameters
    Type Name Description
    String propertyName

    Property name.

    Overrides
    Element.OnPropertyChanged(String)

    OnSizeAllocated(Double, Double)

    Called when the size of the label has been allocate by Xamarin layout system

    Declaration
    protected override void OnSizeAllocated(double width, double height)
    Parameters
    Type Name Description
    Double width
    Double height
    Overrides
    VisualElement.OnSizeAllocated(Double, Double)

    OnSizeRequest(Double, Double)

    Just how big is this going to be?

    Declaration
    protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint)
    Parameters
    Type Name Description
    Double widthConstraint
    Double heightConstraint
    Returns
    Type Description
    SizeRequest
    Overrides
    VisualElement.OnSizeRequest(Double, Double)

    SizeForWidthAndFontSize(Double, Double)

    Sizes the size of the for width and font.

    Declaration
    public Size SizeForWidthAndFontSize(double width, double fontSize)
    Parameters
    Type Name Description
    Double width

    Width.

    Double fontSize

    Font size.

    Returns
    Type Description
    Size

    The for width and font size.

    ToString()

    String representation of Label

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()

    Events

    ActionTagTapped

    Occurs when HtmlText wrapped with an action (<a>) tag is tapped.

    Declaration
    public event EventHandler<ActionTagEventArgs> ActionTagTapped
    Event Type
    Type Description
    EventHandler<ActionTagEventArgs>

    FittedFontSizeChanged

    Occurs when label has performed fitting algorithm. A value of -1 indicates that value of the FontSize property was used.

    Declaration
    public event EventHandler<double> FittedFontSizeChanged
    Event Type
    Type Description
    EventHandler<Double>

    Operators

    Explicit(Label to String)

    Declaration
    public static explicit operator string (Label label)
    Parameters
    Type Name Description
    Label label

    Label.

    Returns
    Type Description
    String

    Implements

    System.ComponentModel.INotifyPropertyChanged
    Xamarin.Forms.IAnimatable
    Xamarin.Forms.ITabStopElement
    Xamarin.Forms.IViewController
    Xamarin.Forms.IVisualElementController
    Xamarin.Forms.IElementController
    Xamarin.Forms.Internals.IGestureController
    Xamarin.Forms.IGestureRecognizers
    Xamarin.Forms.IElementConfiguration<TElement>
    Xamarin.Forms.IDecorableTextElement
    ILabel
    ILabelStyle
    IFontElement
    IElement

    Extension Methods

    VisualElementExtensions.IsDescendentOf(Element, Element)
    VisualElementExtensions.IsAncestorOf(Element, Element)
    VisualElementExtensions.BoundsInWindowCoord(VisualElement)
    VisualElementExtensions.BoundsInElementCoord(VisualElement, VisualElement)
    VisualElementExtensions.LocationInWindowCoord(VisualElement)
    VisualElementExtensions.PointInWindowCoord(VisualElement, Point)
    VisualElementExtensions.LocationInElementCoord(VisualElement, VisualElement)
    VisualElementExtensions.PointInElementCoord(VisualElement, Point, VisualElement)
    VisualElementExtensions.HitTest(VisualElement, Point, VisualElement)
    VisualElementExtensions.GestureListener(VisualElement)
    VisualElementExtensions.FindChildrenWithPropertyAndOfType<T>(VisualElement, String, List<T>)
    VisualElementExtensions.FindChildrenWithProperty(VisualElement, String)
    VisualElementExtensions.FindVisualElementsOfType<T>(VisualElement)
    VisualElementExtensions.FindChildWithFocus(Element)
    VisualElementExtensions.FindAncestorOfType(Element, Type)
    VisualElementExtensions.IsInVisibleViewTree(VisualElement)
    ElementExtensions.AncestorOfBaseType<T>(Element)
    ElementExtensions.Ancestor<T>(Element)
    ElementExtensions.IsInNativeLayout(VisualElement)
    ElementExtensions.SetIsInNativeLayout(VisualElement, Boolean)
    ElementExtensions.GetRenderer(VisualElement)
    ElementExtensions.HasRenderer(VisualElement)
    FontExtensions.LineHeight(IFontElement)
    FontExtensions.LineSpace(IFontElement)
    HardwareKeyListenerExtensions.GetHardwareKeyListeners(View)
    HardwareKeyListenerExtensions.ClearHardwareKeyListeners(View)
    HardwareKeyListenerExtensions.AddHardwareKeyListener(View, String, HardwareKeyModifierKeys, String, EventHandler<HardwareKeyEventArgs>)
    HardwareKeyListenerExtensions.AddHardwareKeyListener(View, String, HardwareKeyModifierKeys, EventHandler<HardwareKeyEventArgs>)
    HardwareKeyListenerExtensions.AddHardwareKeyListener(View, String, EventHandler<HardwareKeyEventArgs>)
    HardwareKeyListenerExtensions.AddHardwareKeyListener(View, String)
    HardwareKeyListenerExtensions.AddHardwareKeyListener(View, HardwareKeyListener)
    HardwareKeyListenerExtensions.RemoveHardwareKeyListener(View, String, HardwareKeyModifierKeys)
    HardwareKeyListenerExtensions.RemoveHardwareKeyListener(View, HardwareKeyListener)
    HardwareKeyListenerExtensions.HardwareKeyFocus(View)
    HardwareKeyListenerExtensions.HardwareKeyUnfocus(VisualElement)
    DebugExtensions.AddToCensus(Object)
    DebugExtensions.RemoveFromCensus(Object)
    ReflectionExtensions.GetProperties(Object)
    ReflectionExtensions.GetProperty(Object, String)
    ReflectionExtensions.PropertyNames(Object)
    ReflectionExtensions.PropertyExists(Object, String)
    ReflectionExtensions.HasProperty(Object, String)
    ReflectionExtensions.GetPropertyValue(Object, String)
    ReflectionExtensions.SetPropertyValue(Object, String, Object)
    ReflectionExtensions.GetFieldValue(Object, String)
    ReflectionExtensions.SetFieldValue(Object, String, Object)
    ReflectionExtensions.CallMethod(Object, String, Object[])
    Back to top Copyright © 2018 42nd Parallel