Class Label
Forms9Patch.Label
Implements
Inherited Members
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
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
OnPropertyChanged(String)
Ons the property changed.
Declaration
protected override void OnPropertyChanged(string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Property name. |
Overrides
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
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
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
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 |