Class TextLabel
Definition
- Namespace:
- Tizen.NUI.BaseComponents
- Assembly:
- Tizen.NUI.dll
A control which renders a short text string.
Text labels are lightweight, non-editable, and do not respond to the user input.
public class TextLabel : View, IDynamicResourceHandler, INameScope, System.IDisposable, IResourcesProvider
- Inheritance
- Derived
- Implements
-
System.IDisposable
Constructors
View SourceTextLabel()
Creates the TextLabel control.
Declaration
public TextLabel()
TextLabel(bool)
Creates the TextLabel with setting the status of shown or hidden.
Declaration
public TextLabel(bool shown)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | shown | false : Not displayed (hidden), true : displayed (shown) |
TextLabel(string, bool)
Creates the TextLabel with setting the status of shown or hidden.
Declaration
public TextLabel(string text, bool shown)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to display |
| bool | shown | false : Not displayed (hidden), true : displayed (shown) |
TextLabel(string)
Creates the TextLabel control.
Declaration
public TextLabel(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to display |
TextLabel(TextLabelStyle)
Declaration
public TextLabel(TextLabelStyle viewStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| TextLabelStyle | viewStyle |
Fields
View SourceAnchorClickedColorProperty
Declaration
public static readonly BindableProperty AnchorClickedColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AnchorColorProperty
Declaration
public static readonly BindableProperty AnchorColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AutoScrollGapProperty
Declaration
public static readonly BindableProperty AutoScrollGapProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AutoScrollLoopCountProperty
Declaration
public static readonly BindableProperty AutoScrollLoopCountProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AutoScrollLoopDelayProperty
Declaration
public static readonly BindableProperty AutoScrollLoopDelayProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AutoScrollSpeedProperty
Declaration
public static readonly BindableProperty AutoScrollSpeedProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
AutoScrollStopModeProperty
Declaration
public static readonly BindableProperty AutoScrollStopModeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
CharacterSpacingProperty
Declaration
public static readonly BindableProperty CharacterSpacingProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
CutoutProperty
CutoutProperty
Declaration
public static readonly BindableProperty CutoutProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
EllipsisPositionProperty
Declaration
public static readonly BindableProperty EllipsisPositionProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
EllipsisProperty
Declaration
public static readonly BindableProperty EllipsisProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
EmbossProperty
Declaration
public static readonly BindableProperty EmbossProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
EnableAutoScrollProperty
Declaration
public static readonly BindableProperty EnableAutoScrollProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
EnableFontSizeScaleProperty
Declaration
public static readonly BindableProperty EnableFontSizeScaleProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
EnableMarkupProperty
Declaration
public static readonly BindableProperty EnableMarkupProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontFamilyProperty
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontSizeScaleProperty
Declaration
public static readonly BindableProperty FontSizeScaleProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
FontStyleProperty
Declaration
public static readonly BindableProperty FontStyleProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
HorizontalAlignmentProperty
Declaration
public static readonly BindableProperty HorizontalAlignmentProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
LineSpacingProperty
Declaration
public static readonly BindableProperty LineSpacingProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
LineWrapModeProperty
Declaration
public static readonly BindableProperty LineWrapModeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
MatchSystemLanguageDirectionProperty
Declaration
public static readonly BindableProperty MatchSystemLanguageDirectionProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
MinLineSizeProperty
Declaration
public static readonly BindableProperty MinLineSizeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
MultiLineProperty
Declaration
public static readonly BindableProperty MultiLineProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
OutlineProperty
Declaration
public static readonly BindableProperty OutlineProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
PixelSizeProperty
Declaration
public static readonly BindableProperty PixelSizeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
PointSizeProperty
Declaration
public static readonly BindableProperty PointSizeProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
RelativeLineHeightProperty
Declaration
public static readonly BindableProperty RelativeLineHeightProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
RemoveBackInsetProperty
RemoveBackInsetProperty
Declaration
public static readonly BindableProperty RemoveBackInsetProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
RemoveFrontInsetProperty
RemoveFrontInsetProperty
Declaration
public static readonly BindableProperty RemoveFrontInsetProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
ShadowColorProperty
ShadowColorProperty
Declaration
public static readonly BindableProperty ShadowColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
ShadowOffsetProperty
ShadowOffsetProperty
Declaration
public static readonly BindableProperty ShadowOffsetProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
ShadowProperty
Declaration
public static readonly BindableProperty ShadowProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TextColorProperty
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TextFitProperty
Declaration
public static readonly BindableProperty TextFitProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TextProperty
Declaration
public static readonly BindableProperty TextProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TextShadowProperty
Declaration
public static readonly BindableProperty TextShadowProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
TranslatableTextProperty
StyleNameProperty
Declaration
public static readonly BindableProperty TranslatableTextProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
UnderlineColorProperty
UnderlineColorProperty
Declaration
public static readonly BindableProperty UnderlineColorProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
UnderlineEnabledProperty
UnderlineEnabledProperty
Declaration
public static readonly BindableProperty UnderlineEnabledProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
UnderlineHeightProperty
UnderlineHeightProperty
Declaration
public static readonly BindableProperty UnderlineHeightProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
UnderlineProperty
Declaration
public static readonly BindableProperty UnderlineProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
VerticalAlignmentProperty
Declaration
public static readonly BindableProperty VerticalAlignmentProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
VerticalLineAlignmentProperty
Declaration
public static readonly BindableProperty VerticalLineAlignmentProperty
Field Value
| Type | Description |
|---|---|
| BindableProperty |
Properties
View SourceAnchorClickedColor
The AnchorClickedColor property.
The color of the clicked anchor.
This property is used as the default clicked color of the markup anchor tag.
If there is a color attribute in the markup anchor tag, the markup attribute takes precedence.
Declaration
public Color AnchorClickedColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
Remarks
The property cascade chaining set is possible. For example, this (textLabel.AnchorClickedColor.X = 0.1f;) is possible.
AnchorColor
The AnchorColor property.
The color of the anchor.
This property is used as the default color of the markup anchor tag.
If there is a color attribute in the markup anchor tag, the markup attribute takes precedence.
Declaration
public Color AnchorColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
Remarks
The property cascade chaining set is possible. For example, this (textLabel.AnchorColor.X = 0.1f;) is possible.
AsyncLineCount
Number of lines after latest asynchronous computing or rendering of text.
Declaration
public int AsyncLineCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Examples
The following example demonstrates how to obtain the LineCount asynchronously.
label.RequestAsyncHeightForWidth(label.Size.Width);
label.AsyncHeightForWidthComputed += (s, e) =>
{
int lineCount = label.AsyncLineCount;
};
View Source
AutoScrollDirection
The AutoScrollDirection.
Declaration
public AutoScrollDirection AutoScrollDirection { get; set; }
Property Value
| Type | Description |
|---|---|
| AutoScrollDirection |
Remarks
Horizontal : Horizontal scrolling of text, only valid when single-line.
Vertical : Vertical scrolling of text, only valid when multi-line.
AutoScrollGap
The AutoScrollGap property.
Gap before scrolling wraps.
Declaration
public float AutoScrollGap { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
AutoScrollLoopCount
The AutoScrollLoopCount property.
Number of complete loops when scrolling enabled.
Declaration
public int AutoScrollLoopCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
AutoScrollLoopDelay
The AutoScrollLoopDelay property.
The amount of time to delay the starting time of auto scrolling and further loops.
Declaration
public float AutoScrollLoopDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
AutoScrollSpeed
The AutoScrollSpeed property.
Sets the speed of scrolling in pixels per second.
Declaration
public int AutoScrollSpeed { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
AutoScrollStopMode
The AutoScrollStopMode property.
The auto scrolling stop behaviour.
The default value is AutoScrollStopMode.FinishLoop.
Declaration
public AutoScrollStopMode AutoScrollStopMode { get; set; }
Property Value
| Type | Description |
|---|---|
| AutoScrollStopMode |
CharacterSpacing
The spaces between characters in Pixels.
The default value is 0.f which does nothing.
Declaration
public float CharacterSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Cutout
The cutout property.
Declaration
public bool Cutout { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
When Cutout is set to true, Elements such as background or shadow behind the text become transparent.
Therefore, when you adjust the transparency of text, you can see the back through the entire TextLabel.
It is recommended to set Cutout to false when Text's transparency is 1.
Examples
The following example demonstrates how to use the Cutout method.
Pixels in which glyph exists become transparent and the back of TextLabel become visible.
TextLabel label = new TextLabel()
{
Cutout = true,
TextColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
};
View Source
Ellipsis
The Ellipsis property.
Enable or disable the ellipsis.
Declaration
public bool Ellipsis { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EllipsisMode
The EllipsisMode property.
Declaration
public EllipsisMode EllipsisMode { get; set; }
Property Value
| Type | Description |
|---|---|
| EllipsisMode |
Remarks
This property is valid when Ellipsis is true.
Truncate(default), if the text exceeds the layout, it will be truncated with an ellipsis.
AutoScroll, if the text exceeds the layout, it will be auto scroll animated.
EllipsisMode.AutoScroll shares the properties of AutoScroll Animation: AutoScrollSpeed, AutoScrollLoopCount, AutoScrollGap, AutoScrollLoopDelay
EllipsisMode.AutoScroll forces the setting of AutoScrollStopMode to Immediate.
To dynamically turn off EllipsisMode.AutoScroll, set EllipsisMode.Truncate.
Cannot be used simultaneously with EnableAutoScroll.
This property supports get/set operations in XAML scripts, but does not support XAML Data Binding functionality.
EllipsisPosition
The ellipsis position of the text.
Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.
Declaration
public EllipsisPosition EllipsisPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| EllipsisPosition |
Emboss
The Emboss property.
The default emboss parameters.
Declaration
public string Emboss { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
EnableAutoScroll
The EnableAutoScroll property.
Starts or stops auto scrolling.
Declaration
public bool EnableAutoScroll { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EnableFontSizeScale
The EnableFontSizeScale property.
Whether the font size scale is enabled. (The default value is true)
Declaration
public bool EnableFontSizeScale { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EnableMarkup
The EnableMarkup property.
Whether the mark-up processing is enabled.
Declaration
public bool EnableMarkup { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
FontFamily
The FontFamily property.
The requested font family to use.
Declaration
public string FontFamily { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
FontSizeScale
The FontSizeScale property for scaling the specified font size up or down.
The default value is 1.0.
The given font size scale value is used for multiplying the specified font size before querying fonts.
If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally.
Declaration
public float FontSizeScale { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
FontStyle
The FontStyle property.
The requested font style to use.
The fontStyle map contains the following keys :
| width (string) | The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded) |
| weight (string) | The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack) |
| slant (string) | The slant key defines whether to use italics. (values: normal, roman, italic, oblique) |
Declaration
public PropertyMap FontStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyMap |
HorizontalAlignment
The HorizontalAlignment property.
The line horizontal alignment.
Declaration
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| HorizontalAlignment |
IsScrolling
Whether the auto scroll animation is playing or not.
Declaration
public bool IsScrolling { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This property supports get operations in XAML scripts, but does not support XAML Data Binding functionality.
LayoutDirectionPolicy
The LayoutDirectionPolicy property.
Declaration
public TextLayoutDirectionPolicy LayoutDirectionPolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| TextLayoutDirectionPolicy |
Remarks
Inherit : The text layout direction is inherited. If you change the layout direction, it will be aligned with the changed layout direction.
Locale : The text layout direction is determined by the locale of the system language.
Contents : The text layout direction is determined by the text itself.
LineCount
Gets the line count of the text.
Declaration
public int LineCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
LineSpacing
The LineSpacing property.
The default extra space between lines in points.
Declaration
public float LineSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
LineWrapMode
The LineWrapMode property.
line wrap mode when the text lines over layout width.
Declaration
public LineWrapMode LineWrapMode { get; set; }
Property Value
| Type | Description |
|---|---|
| LineWrapMode |
ManualRendered
Whether the last async rendering result is a manual render.
If it's false, the render result was automatically requested by OnRelayout.
Declaration
public bool ManualRendered { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MatchSystemLanguageDirection
The text alignment to match the direction of the system language.
Declaration
public bool MatchSystemLanguageDirection { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MinLineSize
The MinLineSize property.
The height of the line in points.
If the font size is larger than the line size, it works with the font size.
Declaration
public float MinLineSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MultiLine
The MultiLine property.
The single-line or multi-line layout option.
Declaration
public bool MultiLine { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Outline
The Outline property.
The default outline parameters.
The outline map contains the following keys :
| color (Color) | The color of the outline (the default color is Color.White) |
| width (float) | The width in pixels of the outline (If not provided then the outline is not enabled) |
Declaration
public PropertyMap Outline { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyMap |
PixelSize
The PixelSize property.
The size of font in pixels.
Declaration
public float PixelSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
PixelSnapFactor
A factor of pixel snap.
Declaration
public float PixelSnapFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
It should be 0.0 ~ 1.0.
Controls the degree of pixel snapping applied to the visual position.
A value of 0.0 means no snapping is applied (original position is preserved), while 1.0 applies full pixel alignment.
Intermediate values blend smoothly between the original and snapped positions using linear interpolation (mix) in the vertex shader.
Typical usage:
To ensure both smooth animations and sharp visual alignment,
transition the pixelSnapFactor value gradually from 0.0 to 1.0 during or after animations.
This allows the snapping to engage seamlessly without visible jitter or popping, maintaining both visual quality and motion fluidity.
Use 0.0 during animation to avoid snapping artifacts.
Gradually increase to 1.0 as the animation settles, for crisp pixel alignment.
Examples
The following example demonstrates how to use the PixelSnapFactor with RenderScale.
label.FocusGained += (s, e) =>
{
float scaleUp = 1.5f;
label.RenderScale = scaleUp;
scaleAnimation = new Animation(200);
scaleAnimation.AnimateTo(label, "scale", new Vector3(scaleUp, scaleUp, 1.0f));
scaleAnimation.Play();
pixelSnapAnimation = new Animation(200);
pixelSnapAnimation.AnimateTo(label, "pixelSnapFactor", 1.0f);
pixelSnapAnimation.Play();
};
label.FocusLost += (s, e) =>
{
float normalScale = 1.0f;
label.RenderScale = normalScale;
scaleAnimation = new Animation(200);
scaleAnimation.AnimateTo(label, "scale", new Vector3(normalScale, normalScale, 1.0f));
scaleAnimation.Play();
pixelSnapAnimation = new Animation(200);
pixelSnapAnimation.AnimateTo(label, "pixelSnapFactor", 0.0f);
pixelSnapAnimation.Play();
};
View Source
PointSize
The PointSize property.
The size of font in points.
Declaration
public float PointSize { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
RelativeLineHeight
The relative height of the line (a factor that will be multiplied by text height).
If the value is less than 1, the lines could to be overlapped.
Declaration
public float RelativeLineHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
RemoveBackInset
The RemoveBackInset property.
This property is used when the advance of last glyph must not be trimmed.
When set to false, The gap between the last glyph's rightmost pixel and X coordinate that next glyph will be placed is included in the width of text label.
Declaration
public bool RemoveBackInset { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
RemoveFrontInset
The RemoveFrontInset property.
This property is used when the xBearing of first glyph must not be trimmed.
When set to false, The gap between (0, 0) from the first glyph's leftmost pixel is included in the width of text label.
Declaration
public bool RemoveFrontInset { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
RenderMode
The RenderMode property.
Declaration
public TextRenderMode RenderMode { get; set; }
Property Value
| Type | Description |
|---|---|
| TextRenderMode |
Remarks
Sync : default, synchronous text loading.
AsyncAuto : automatically requests an asynchronous text load in OnRelayout.
AsyncManual : users should manually request rendering using the async text method.
All text rendering processes (update/layout/render) are performed asynchronously in AsyncAuto and AsyncManual.
RenderScale
Renders a texture at a specified scale to prevent text rendering quality degradation when scaling up with View.Scale.
Declaration
public float RenderScale { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
RenderScale is only available in TextRenderMode.AsyncAuto and TextRenderMode.AsyncManual.
It is only valid when set to 1.0 or greater.
This property scales up the point size and texture size to the specified scale.
For example, the results of the rendered textures below are nearly identical:
FontSize: 20, RenderScale: 1.5
FontSize: 20, FontSizeScale: 1.5
However, the texture rendered with the specified RenderScale is downscaled to the original(1.0 scale) size and applied to the visual transform.
When the texture is increased by View.Scale, its size becomes 100%, ensuring high-quality rendering.
To achieve optimal text rendering results when using View.Scale, RenderScale should be set to the same value.
Examples
The following example demonstrates how to use the RenderScale.
label.FocusGained += (s, e) =>
{
float scaleUp = 1.5f;
label.RenderScale = scaleUp;
scaleAnimation = new Animation(200);
scaleAnimation.AnimateTo(label, "scale", new Vector3(scaleUp, scaleUp, 1.0f));
scaleAnimation.Play();
};
label.FocusLost += (s, e) =>
{
float normalScale = 1.0f;
label.RenderScale = normalScale;
scaleAnimation = new Animation(200);
scaleAnimation.AnimateTo(label, "scale", new Vector3(normalScale, normalScale, 1.0f));
scaleAnimation.Play();
};
View Source
Shadow
The Shadow property.
The default shadow parameters.
The shadow map contains the following keys :
| color (Color) | The color of the shadow (the default color is Color.Black) |
| offset (Vector2) | The offset in pixels of the shadow (If not provided then the shadow is not enabled) |
| blurRadius (float) | The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled) |
Declaration
public PropertyMap Shadow { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyMap |
ShadowColor
The ShadowColor property.
The color of a drop shadow.
Declaration
public Vector4 ShadowColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Remarks
Deprecated.(API Level 6) Use Shadow instead. The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
ShadowOffset
The ShadowOffset property.
The drop shadow offset 0 indicates no shadow.
Declaration
public Vector2 ShadowOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Remarks
Deprecated.(API Level 6) Use Shadow instead. The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
Text
The Text property.
The text to display in the UTF-8 format.
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
TextColor
The TextColor property.
The color of the text.
Animation framework can be used to change the color of the text when not using mark up.
Cannot animate the color when text is auto scrolling.
Declaration
public Color TextColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
Remarks
The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
TextDirection
The direction of the text such as left to right or right to left.
Declaration
public TextDirection TextDirection { get; }
Property Value
| Type | Description |
|---|---|
| TextDirection |
TextFit
The text fit parameters.
The textFit map contains the following keys :
| enable (bool) | True to enable the text fit or false to disable (the default value is false) |
| minSize (float) | Minimum Size for text fit (the default value is 10.f) |
| maxSize (float) | Maximum Size for text fit (the default value is 100.f) |
| stepSize (float) | Step Size for font increase (the default value is 1.f) |
| fontSize (string) | The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize") |
Declaration
public PropertyMap TextFit { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyMap |
TextShadow
Describes a text shadow for a TextLabel. It is null by default.
Declaration
public TextShadow TextShadow { get; set; }
Property Value
| Type | Description |
|---|---|
| TextShadow |
TranslatableText
The TranslatableText property.
The text can set the SID value.
Declaration
public string TranslatableText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Underline
The Underline property.
The default underline parameters.
The underline map contains the following keys :
| enable (bool) | Whether the underline is enabled (the default value is false) |
| color (Color) | The color of the underline (If not provided then the color of the text is used) |
| height (float) | The height in pixels of the underline (the default value is 1.f) |
Declaration
public PropertyMap Underline { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyMap |
UnderlineColor
The UnderlineColor property.
Overrides the underline height from font metrics.
Declaration
public Vector4 UnderlineColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Remarks
Deprecated.(API Level 6) Use Underline instead. The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
UnderlineEnabled
The UnderlineEnabled property.
The underline enabled flag.
Declaration
public bool UnderlineEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Deprecated.(API Level 6) Use Underline instead.
UnderlineHeight
The UnderlineHeight property.
Overrides the underline height from font metrics.
Declaration
public float UnderlineHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Deprecated.(API Level 6) Use Underline instead.
VerticalAlignment
The VerticalAlignment property.
The line vertical alignment.
Declaration
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| VerticalAlignment |
VerticalLineAlignment
The vertical line alignment of the text.
Declaration
public VerticalLineAlignment VerticalLineAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| VerticalLineAlignment |
Methods
View SourceCreateViewStyle()
Get attribues, it is abstract function and must be override.
Declaration
protected override ViewStyle CreateViewStyle()
Returns
| Type | Description |
|---|---|
| ViewStyle |
Overrides
View SourceDispose(DisposeTypes)
you can override it to clean-up your own resources.
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
| Type | Name | Description |
|---|---|---|
| DisposeTypes | type | DisposeTypes |
Overrides
View SourceDownCast(BaseHandle)
Downcasts a handle to textLabel handle
Declaration
public static TextLabel DownCast(BaseHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseHandle | handle |
Returns
| Type | Description |
|---|---|
| TextLabel |
GetEmboss()
Get Emboss from TextLabel.
| enable (bool) | Whether the emboss is enabled (the default value is false) |
| direction (Vector2) | The emboss direction in texture space. (the default value is (0.0f, 0.0f).) |
| strength (float) | The strength of emboss in pixels. (the default value is 0.0f.) |
| lightColor (Color) | The highlight color for raised areas. (the default value is transparent.) |
| shadowColor (Color) | The shadow color for recessed areas. (the default value is transparent.) |
Declaration
public Emboss GetEmboss()
Returns
| Type | Description |
|---|---|
| Emboss |
GetFontStyle()
Get FontStyle from TextLabel.
Declaration
public FontStyle GetFontStyle()
Returns
| Type | Description |
|---|---|
| FontStyle | The FontStyle |
Remarks
View SourceGetOutline()
Get Outline from TextLabel.
Declaration
public Outline GetOutline()
Returns
| Type | Description |
|---|---|
| Outline | The Outline |
Remarks
View SourceGetShadow()
Get Shadow from TextLabel.
Declaration
public Shadow GetShadow()
Returns
| Type | Description |
|---|---|
| Shadow | The Shadow |
Remarks
View SourceGetStrikethrough()
Get Strikethrough from TextLabel.
Declaration
public Strikethrough GetStrikethrough()
Returns
| Type | Description |
|---|---|
| Strikethrough | The Strikethrough |
Remarks
View SourceGetStringProperty(string)
Gets a string property by name.
Declaration
public string GetStringProperty(string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName | The name of the property to retrieve. |
Returns
| Type | Description |
|---|---|
| string | The string value of the property, or null if not found. |
GetTextFit()
Get TextFit from TextLabel.
Declaration
public TextFit GetTextFit()
Returns
| Type | Description |
|---|---|
| TextFit | The TextFit |
Remarks
TextFit is always returned based on PointSize.
If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned.
TextFit
GetTextFitArray()
Get TextFitArray from TextLabel.
Declaration
public TextFitArray GetTextFitArray()
Returns
| Type | Description |
|---|---|
| TextFitArray | The TextFitArray |
Remarks
See TextFitArray and TextFitArrayOption.
Examples
The following example demonstrates how to use the GetTextFitArray method.
Tizen.NUI.Text.TextFitArray textFitArray = label.GetTextFitArray();
bool enable = textFitArray.Enable;
var optionList = textFitArray.OptionList;
foreach(Tizen.NUI.Text.TextFitArrayOption option in optionList)
{
float pointSize = option.PointSize;
float minLinesize = option.MinLineSize;
}
View Source
GetUnderline()
Get Underline from TextLabel.
Declaration
public Underline GetUnderline()
Returns
| Type | Description |
|---|---|
| Underline | The Underline |
Remarks
View SourceOnBindingContextChanged()
Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
Declaration
protected override void OnBindingContextChanged()
Overrides
View SourceRegisterFontVariationProperty(string)
Registers FontVariationsProperty with string tag.
Declaration
public int RegisterFontVariationProperty(string tag)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag | The tag of font variation. |
Returns
| Type | Description |
|---|---|
| int | The index of the font variation. |
Remarks
The returned index can be used with setting property or animations.
Examples
The following example demonstrates how to use the SetFontStyle method.
TextLabel label = new TextLabel();
int index = label.RegisterFontVariationProperty("wght");
Animation anim = new Animation(1000);
anim.AnimateTo(label, "wght", 900.0f);
View Source
ReleaseSwigCPtr(HandleRef)
Declaration
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.InteropServices.HandleRef | swigCPtr |
Overrides
View SourceRemoveMaskEffect()
Removes mask Effect to given view.
Declaration
public void RemoveMaskEffect()
Remarks
After this operation, the masked control unparents the Textlabel.
RequestAsyncHeightForWidth(float)
Requests asynchronous computation of the height of the text based on the given width.
Declaration
public void RequestAsyncHeightForWidth(float width)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width of text to compute. |
Remarks
If another request occurs before the requested height for width computation is completed, the previous request will be canceled.
RequestAsyncNaturalSize()
Requests asynchronous text natural size computation.
Declaration
public void RequestAsyncNaturalSize()
Remarks
If another request occurs before the requested natural size computation is completed, the previous request will be canceled.
RequestAsyncRenderWithConstraint(float, float)
Requests asynchronous rendering with the maximum available width using the given widthConstraint.
Declaration
public void RequestAsyncRenderWithConstraint(float widthConstraint, float heightConstraint = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float | widthConstraint | The maximum available width of text to render. |
| float | heightConstraint | The maximum available height of text to render. |
Remarks
Only works when AsyncAuto and AsyncManual.
If the width of the text content is smaller than the widthConstraint, the width will be determined by the width of the text.
If the width of the text content is larger than the widthConstraint, the width will be determined by the widthConstraint.
The height is determined by the content of the text when rendered with the given width.
In this case, the result will be the same as the height returned by GetHeightForWidth.
If the heightConstraint is given, the maximum height will be the heightConstraint.
If another request occurs before the requested render is completed, the previous request will be canceled.
In AsyncAuto, the manual request is not canceled by an auto request caused by OnRealyout.
RequestAsyncRenderWithFixedHeight(float, float)
Requests asynchronous text rendering with a fixed height.
Declaration
public void RequestAsyncRenderWithFixedHeight(float widthConstraint, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | widthConstraint | The maximum available width of text to render. |
| float | height | The height of text to render. |
Remarks
Only works when AsyncAuto and AsyncManual.
The width is determined by the content of the text.
The maximum width will be the widthConstraint.
RequestAsyncRenderWithFixedSize(float, float)
Requests asynchronous rendering of text with a fixed size.
Declaration
public void RequestAsyncRenderWithFixedSize(float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width of text to render. |
| float | height | The height of text to render. |
Remarks
Only works when AsyncAuto and AsyncManual.
If another request occurs before the requested render is completed, the previous request will be canceled.
In AsyncAuto, the manual request is not canceled by an auto request caused by OnRealyout.
RequestAsyncRenderWithFixedWidth(float, float)
Requests asynchronous text rendering with a fixed width.
Declaration
public void RequestAsyncRenderWithFixedWidth(float width, float heightConstraint = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width of text to render. |
| float | heightConstraint | The maximum available height of text to render. |
Remarks
Only works when AsyncAuto and AsyncManual.
The height is determined by the content of the text when rendered with the given width.
The result will be the same as the height returned by GetHeightForWidth.
If the heightConstraint is given, the maximum height will be the heightConstraint.
If another request occurs before the requested render is completed, the previous request will be canceled.
In AsyncAuto, the manual request is not canceled by an auto request caused by OnRealyout.
SetEmboss(Emboss)
Set Emboss to TextLabel.
| enable (bool) | Whether the emboss is enabled (the default value is false) |
| direction (Vector2) | The emboss direction in texture space. (the default value is (0.0f, 0.0f).) |
| strength (float) | The strength of emboss in pixels. (the default value is 0.0f.) |
| lightColor (Color) | The highlight color for raised areas. (the default value is transparent.) |
| shadowColor (Color) | The shadow color for recessed areas. (the default value is transparent.) |
Declaration
public void SetEmboss(Emboss emboss)
Parameters
| Type | Name | Description |
|---|---|---|
| Emboss | emboss |
SetFontStyle(FontStyle)
Set FontStyle to TextLabel.
Declaration
public void SetFontStyle(FontStyle fontStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| FontStyle | fontStyle | The FontStyle |
Remarks
SetFontStyle specifies the requested font style through FontStyle.
Examples
The following example demonstrates how to use the SetFontStyle method.
var fontStyle = new Tizen.NUI.Text.FontStyle();
fontStyle.Width = FontWidthType.Expanded;
fontStyle.Weight = FontWeightType.Bold;
fontStyle.Slant = FontSlantType.Italic;
label.SetFontStyle(fontStyle);
View Source
SetFontVariation(int, float)
Sets Font Variation with index.
Declaration
public void SetFontVariation(int index, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of font variation property. |
| float | value | The value of font variation. |
Remarks
To use the index, RegisterFontVariationProperty must precede it.
SetFontVariation(string, float)
Sets Font Variation with string tag.
Declaration
public void SetFontVariation(string tag, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag | The tag of font variation. |
| float | value | The value of font variation. |
SetMaskEffect(View)
Sets mask Effect to given view.
Declaration
public void SetMaskEffect(View control)
Parameters
| Type | Name | Description |
|---|---|---|
| View | control | The control to set mask effect. |
Remarks
After this operation, the Textlabel will be parent of the control.
SetOutline(Outline)
Set Outline to TextLabel.
Declaration
public void SetOutline(Outline outline)
Parameters
| Type | Name | Description |
|---|---|---|
| Outline | outline | The Outline |
Remarks
SetOutline specifies the outline of the text through Outline.
Examples
The following example demonstrates how to use the SetOutline method.
var outline = new Tizen.NUI.Text.Outline();
outline.Width = 2.0f;
outline.Color = new Color("#45B39D");
label.SetOutline(outline);
View Source
SetShadow(Shadow)
Set Shadow to TextLabel.
Declaration
public void SetShadow(Shadow shadow)
Parameters
| Type | Name | Description |
|---|---|---|
| Shadow | shadow | The Shadow |
Remarks
SetShadow specifies the shadow of the text through Shadow.
Examples
The following example demonstrates how to use the SetShadow method.
var shadow = new Tizen.NUI.Text.Shadow();
shadow.Offset = new Vector2(3, 3);
shadow.Color = new Color("#F1C40F");
shadow.BlurRadius = 4.0f;
label.SetShadow(shadow);
View Source
SetStrikethrough(Strikethrough)
Set Strikethrough to TextLabel.
Declaration
public void SetStrikethrough(Strikethrough strikethrough)
Parameters
| Type | Name | Description |
|---|---|---|
| Strikethrough | strikethrough | The Strikethrough |
Remarks
SetStrikethrough specifies the strikethrough of the text through Strikethrough.
Examples
The following example demonstrates how to use the SetStrikethrough method.
var strikethrough = new Tizen.NUI.Text.Strikethrough();
strikethrough.Enable = true;
strikethrough.Color = new Color("#3498DB");
strikethrough.Height = 2.0f;
label.SetStrikethrough(strikethrough);
View Source
SetTextFit(TextFit)
Set TextFit to TextLabel.
Declaration
public void SetTextFit(TextFit textFit)
Parameters
| Type | Name | Description |
|---|---|---|
| TextFit | textFit | The TextFit |
Remarks
SetTextFit specifies the textFit of the text through TextFit.
Examples
The following example demonstrates how to use the SetTextFit method.
var textFit = new Tizen.NUI.Text.TextFit();
textFit.Enable = true;
textFit.MinSize = 10.0f;
textFit.MaxSize = 100.0f;
textFit.StepSize = 5.0f;
textFit.FontSizeType = FontSizeType.PointSize;
label.SetTextFit(textFit);
View Source
SetTextFitArray(TextFitArray)
Set TextFitArray to TextLabel.
TextFitArray finds and applies the largest PointSize that fits among OptionList.
Declaration
public void SetTextFitArray(TextFitArray textFitArray)
Parameters
| Type | Name | Description |
|---|---|---|
| TextFitArray | textFitArray | The TextFitArray |
Remarks
TextFitArray tries binary search by default.
The precondition for TextFitArray to perform binary search is sorting in ascending order of MinLineSize.
Because if MinLineSize is not sorted in ascending order,
binary search cannot guarantee that it will always find the best value.
In this case, the search sequentially starts from the largest PointSize.
If TextFitArrayOption's MinLineSize is set to null or 0,
TextFitArray is calculated without applying MinLineSize.
If TextFitArray is enabled, TextLabel's MinLineSize property is ignored.
See TextFitArray and TextFitArrayOption.
Examples
The following example demonstrates how to use the SetTextFitArray method.
var textFitArray = new Tizen.NUI.Text.TextFitArray();
textFitArray.Enable = true;
textFitArray.OptionList = new List<Tizen.NUI.Text.TextFitArrayOption>()
{
new Tizen.NUI.Text.TextFitArrayOption(12, 18),
new Tizen.NUI.Text.TextFitArrayOption(24, 40),
new Tizen.NUI.Text.TextFitArrayOption(28, 48),
new Tizen.NUI.Text.TextFitArrayOption(32, 56),
new Tizen.NUI.Text.TextFitArrayOption(50, 72),
};
label.SetTextFitArray(textFitArray);
The table below shows cases where binary search is possible and where it is not possible.
[Binary search possible]
| | List index | 0 | 1 | 2 | 3 |
| OptionList | PointSize | 24 | 28 | 32 | 48 |
| | MinLineSize | 40 | 48 | 48 | 62 | << MinLineSize sorted in ascending order
^ ^
same values are not a problem
[Binary search not possible]
| | List index | 0 | 1 | 2 | 3 |
| OptionList | PointSize | 24 | 28 | 32 | 48 |
| | MinLineSize | 40 | 48 | 38 | 62 | << MinLineSize is not sorted in ascending order
^
View Source
SetUnderline(Underline)
Set Underline to TextLabel.
Declaration
public void SetUnderline(Underline underline)
Parameters
| Type | Name | Description |
|---|---|---|
| Underline | underline | The Underline |
Remarks
SetUnderline specifies the underline of the text through Underline.
Examples
The following example demonstrates how to use the SetUnderline method.
var underline = new Tizen.NUI.Text.Underline();
underline.Enable = true;
underline.Color = new Color("#3498DB");
underline.Height = 2.0f;
label.SetUnderline(underline);
Events
View SourceAnchorClicked
The AnchorClicked signal is emitted when the anchor is clicked.
Declaration
public event EventHandler<AnchorClickedEventArgs> AnchorClicked
Event Type
| Type | Description |
|---|---|
| EventHandler<><AnchorClickedEventArgs> |
AsyncHeightForWidthComputed
The AsyncHeightForWidthComputed signal is emitted when the async natural size computed.
Declaration
public event EventHandler<AsyncTextSizeComputedEventArgs> AsyncHeightForWidthComputed
Event Type
| Type | Description |
|---|---|
| EventHandler<><AsyncTextSizeComputedEventArgs> |
AsyncNaturalSizeComputed
The AsyncNaturalSizeComputed signal is emitted when the async natural size computed.
Declaration
public event EventHandler<AsyncTextSizeComputedEventArgs> AsyncNaturalSizeComputed
Event Type
| Type | Description |
|---|---|
| EventHandler<><AsyncTextSizeComputedEventArgs> |
AsyncTextRendered
The AsyncTextRendered signal is emitted when the async text rendered.
Declaration
public event EventHandler<AsyncTextRenderedEventArgs> AsyncTextRendered
Event Type
| Type | Description |
|---|---|
| EventHandler<><AsyncTextRenderedEventArgs> |
TextFitChanged
An event for the TextFitChanged signal which can be used to subscribe or unsubscribe the event handler
provided by the user. The TextFitChanged signal is emitted when the text fit properties changes.
Declaration
public event EventHandler TextFitChanged
Event Type
| Type | Description |
|---|---|
| EventHandler |