10 instantiations of Label
Microsoft.Maui.Controls (10)
BindableLayout\BindableLayout.cs (2)
234
var label = new
Label
{ HorizontalTextAlignment = TextAlignment.Center };
489
return new
Label
{ Text = emptyView?.ToString(), HorizontalTextAlignment = TextAlignment.Center };
Compatibility\Handlers\Shell\iOS\ShellSearchResultsRenderer.cs (1)
40
var label = new
Label
();
ContentConverter.cs (1)
49
var label = new
Label
ElementTemplate.cs (1)
81
return new
Label
();
Internals\ProfilePage.cs (1)
114
var label = new
Label
();
ListView\ListView.cs (1)
676
view = new
Label
{ Text = dataObject.ToString() };
Shell\BaseShellItem.cs (1)
482
var label = new
Label
();
TitleBar\TitleBar.cs (2)
428
var titleLabel = new
Label
()
481
var subtitleLabel = new
Label
()
171 references to Label
Microsoft.Maui.Controls (137)
BindableLayout\BindableLayout.cs (2)
234
var
label = new Label { HorizontalTextAlignment = TextAlignment.Center };
235
label.SetBinding(
Label
.TextProperty, static (object o) => o);
Compatibility\Handlers\Shell\iOS\ShellSearchResultsRenderer.cs (3)
40
var
label = new Label();
48
label.SetBinding(
Label
.TextProperty, SearchHandler.DisplayMemberName ?? ".");
64
label.SetBinding(
Label
.TextProperty, static (object o) => o);
Compatibility\iOS\ResourcesProvider.cs (3)
54
var result = new Style(typeof(
Label
));
56
result.Setters.Add(new Setter { Property =
Label
.FontSizeProperty, Value = (double)font.PointSize });
58
result.Setters.Add(new Setter { Property =
Label
.FontFamilyProperty, Value = font.Name });
ContentConverter.cs (2)
47
static
Label
ConvertToLabel(string textContent, ContentPresenter presenter)
49
var
label = new Label
Device.cs (6)
165
public static readonly Style TitleStyle = new Style(typeof(
Label
)) { BaseResourceKey = TitleStyleKey };
167
public static readonly Style SubtitleStyle = new Style(typeof(
Label
)) { BaseResourceKey = SubtitleStyleKey };
169
public static readonly Style BodyStyle = new Style(typeof(
Label
)) { BaseResourceKey = BodyStyleKey };
171
public static readonly Style ListItemTextStyle = new Style(typeof(
Label
)) { BaseResourceKey = ListItemTextStyleKey };
173
public static readonly Style ListItemDetailTextStyle = new Style(typeof(
Label
)) { BaseResourceKey = ListItemDetailTextStyleKey };
175
public static readonly Style CaptionStyle = new Style(typeof(
Label
)) { BaseResourceKey = CaptionStyleKey };
FontSizeConverter.cs (12)
57
var type = serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget valueTargetProvider ? valueTargetProvider.TargetObject.GetType() : typeof(
Label
);
77
return Device.GetNamedSize(NamedSize.Default, typeof(
Label
), false);
79
return Device.GetNamedSize(NamedSize.Micro, typeof(
Label
), false);
81
return Device.GetNamedSize(NamedSize.Small, typeof(
Label
), false);
83
return Device.GetNamedSize(NamedSize.Medium, typeof(
Label
), false);
85
return Device.GetNamedSize(NamedSize.Large, typeof(
Label
), false);
87
return Device.GetNamedSize(NamedSize.Body, typeof(
Label
), false);
89
return Device.GetNamedSize(NamedSize.Caption, typeof(
Label
), false);
91
return Device.GetNamedSize(NamedSize.Header, typeof(
Label
), false);
93
return Device.GetNamedSize(NamedSize.Subtitle, typeof(
Label
), false);
95
return Device.GetNamedSize(NamedSize.Title, typeof(
Label
), false);
97
return Device.GetNamedSize(namedSize, typeof(
Label
), false);
Hosting\AppHostBuilderExtensions.cs (2)
76
handlersCollection.AddHandler<
Label
, LabelHandler>();
247
Label
.RemapForControls();
Internals\ProfilePage.cs (1)
114
var
label = new Label();
Label\Label.cs (22)
18
public partial class Label : View, IFontElement, ITextElement, ITextAlignmentElement, ILineHeightElement, IElementConfiguration<
Label
>, IDecorableTextElement, IPaddingElement, ILabel
24
public static readonly BindableProperty VerticalTextAlignmentProperty = BindableProperty.Create(nameof(VerticalTextAlignment), typeof(TextAlignment), typeof(
Label
), TextAlignment.Start);
33
public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(
Label
), default(string), propertyChanged: OnTextPropertyChanged);
54
public static readonly BindableProperty FormattedTextProperty = BindableProperty.Create(nameof(FormattedText), typeof(FormattedString), typeof(
Label
), default(FormattedString),
60
var
label = ((
Label
)bindable);
71
var
label = ((
Label
)bindable);
101
public static readonly BindableProperty LineBreakModeProperty = BindableProperty.Create(nameof(LineBreakMode), typeof(LineBreakMode), typeof(
Label
), LineBreakMode.WordWrap,
102
propertyChanged: (bindable, oldvalue, newvalue) => ((
Label
)bindable).InvalidateMeasureIfLabelSizeable());
108
public static readonly BindableProperty MaxLinesProperty = BindableProperty.Create(nameof(MaxLines), typeof(int), typeof(
Label
), -1,
109
propertyChanged: (bindable, oldvalue, newvalue) => ((
Label
)bindable).InvalidateMeasureIfLabelSizeable());
115
public static readonly BindableProperty TextTypeProperty = BindableProperty.Create(nameof(TextType), typeof(TextType), typeof(
Label
), TextType.Text,
116
propertyChanged: (bindable, oldvalue, newvalue) => ((
Label
)bindable).InvalidateMeasureIfLabelSizeable());
118
readonly Lazy<PlatformConfigurationRegistry<
Label
>> _platformConfigurationRegistry;
123
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<
Label
>>(() => new PlatformConfigurationRegistry<
Label
>(this));
364
var
label = (
Label
)bindable;
374
public IPlatformElementConfiguration<T,
Label
> On<T>() where T : IConfigPlatform
437
internal static bool IsLabelSizeable(
Label
label)
460
internal static bool TextChangedShouldInvalidateMeasure(
Label
label)
Label\Label.iOS.cs (6)
20
public static void MapText(LabelHandler handler,
Label
label) => MapText((ILabelHandler)handler, label);
22
public static void MapText(ILabelHandler handler,
Label
label)
29
public static void MapLineBreakMode(ILabelHandler handler,
Label
label)
34
public static void MapMaxLines(ILabelHandler handler,
Label
label)
39
static void MapFormatting(ILabelHandler handler,
Label
label)
58
if (labelHandler.PlatformView is not UILabel platformView || labelHandler.VirtualView is not
Label
virtualView)
Label\Label.Mapper.cs (35)
19
LabelHandler.Mapper.ReplaceMapping<
Label
, ILabelHandler>(nameof(TextType), MapTextType);
20
LabelHandler.Mapper.ReplaceMapping<
Label
, ILabelHandler>(nameof(TextTransform), MapTextTransform);
23
LabelHandler.Mapper.ReplaceMapping<
Label
, ILabelHandler>(nameof(Text), MapText);
24
LabelHandler.Mapper.ReplaceMapping<
Label
, ILabelHandler>(nameof(FormattedText), MapText);
26
LabelHandler.Mapper.ReplaceMapping<
Label
, ILabelHandler>(nameof(LineBreakMode), MapLineBreakMode);
27
LabelHandler.Mapper.ReplaceMapping<
Label
, ILabelHandler>(nameof(MaxLines), MapMaxLines);
31
LabelHandler.Mapper.ModifyMapping<
Label
, ILabelHandler>(nameof(ILabel.Font), MapFont);
32
LabelHandler.Mapper.ModifyMapping<
Label
, ILabelHandler>(nameof(TextColor), MapTextColor);
35
LabelHandler.Mapper.ModifyMapping<
Label
, ILabelHandler>(nameof(TextDecorations), MapTextDecorations);
36
LabelHandler.Mapper.ModifyMapping<
Label
, ILabelHandler>(nameof(CharacterSpacing), MapCharacterSpacing);
37
LabelHandler.Mapper.ModifyMapping<
Label
, ILabelHandler>(nameof(LineHeight), MapLineHeight);
51
public static void MapTextType(LabelHandler handler,
Label
label) =>
53
public static void MapTextType(ILabelHandler handler,
Label
label) =>
55
static void MapTextTransform(ILabelHandler handler,
Label
label) =>
57
static void MapTextOrFormattedText(ILabelHandler handler,
Label
label)
68
public static void MapTextDecorations(ILabelHandler handler,
Label
label) =>
71
public static void MapCharacterSpacing(ILabelHandler handler,
Label
label) =>
74
public static void MapLineHeight(ILabelHandler handler,
Label
label) =>
77
public static void MapFont(ILabelHandler handler,
Label
label) =>
80
public static void MapTextColor(ILabelHandler handler,
Label
label) =>
83
public static void MapTextDecorations(LabelHandler handler,
Label
label) =>
86
public static void MapCharacterSpacing(LabelHandler handler,
Label
label) =>
89
public static void MapLineHeight(LabelHandler handler,
Label
label) =>
92
public static void MapFont(LabelHandler handler,
Label
label) =>
95
public static void MapTextColor(LabelHandler handler,
Label
label) =>
101
static void MapLineHeight(ILabelHandler handler,
Label
label, Action<IElementHandler, IElement> baseMethod)
109
static void MapTextDecorations(ILabelHandler handler,
Label
label, Action<IElementHandler, IElement> baseMethod)
117
static void MapCharacterSpacing(ILabelHandler handler,
Label
label, Action<IElementHandler, IElement> baseMethod)
127
static void MapFont(ILabelHandler handler,
Label
label, Action<IElementHandler, IElement> baseMethod)
143
static void MapTextColor(ILabelHandler handler,
Label
label, Action<IElementHandler, IElement> baseMethod)
161
static bool IsPlainText(
Label
label)
172
static bool IsDefaultFont(
Label
label)
174
if (label.IsSet(
Label
.FontAttributesProperty))
177
if (label.IsSet(
Label
.FontFamilyProperty))
180
if (label.IsSet(
Label
.FontSizeProperty))
Platform\iOS\Extensions\FormattedStringExtensions.cs (2)
23
public static NSAttributedString? ToNSAttributedString(this
Label
label)
134
internal static void RecalculateSpanPositions(this UILabel control,
Label
element)
Platform\iOS\Extensions\LabelExtensions.cs (1)
12
public static void UpdateText(this UILabel platformLabel,
Label
label)
Platform\iOS\Extensions\TextExtensions.cs (3)
76
public static void UpdateLineBreakMode(this UILabel platformLabel,
Label
label)
81
public static void UpdateMaxLines(this UILabel platformLabel,
Label
label)
86
internal static void SetLineBreakMode(this UILabel platformLabel,
Label
label)
PlatformConfiguration\TizenSpecific\Label.cs (5)
4
using FormsElement = Maui.Controls.
Label
;
10
public static readonly BindableProperty FontWeightProperty = BindableProperty.Create("FontWeight", typeof(string), typeof(
FormsElement
), FontWeight.None);
25
public static string GetFontWeight(this IPlatformElementConfiguration<Tizen,
FormsElement
> config)
31
public static IPlatformElementConfiguration<Tizen,
FormsElement
> SetFontWeight(this IPlatformElementConfiguration<Tizen,
FormsElement
> config, string weight)
PlatformConfiguration\WindowsSpecific\Label.cs (5)
6
using FormsElement = Maui.Controls.
Label
;
12
public static readonly BindableProperty DetectReadingOrderFromContentProperty = BindableProperty.Create("DetectReadingOrderFromContent", typeof(bool), typeof(
FormsElement
), false);
21
public static bool GetDetectReadingOrderFromContent(this IPlatformElementConfiguration<Windows,
FormsElement
> config)
33
public static IPlatformElementConfiguration<Windows,
FormsElement
> SetDetectReadingOrderFromContent(
34
this IPlatformElementConfiguration<Windows,
FormsElement
> config, bool value)
Properties\AssemblyInfo.cs (3)
111
[assembly: StyleProperty("max-lines", typeof(
Label
), nameof(
Label
.MaxLinesProperty))]
160
[assembly: StyleProperty("-maui-vertical-text-alignment", typeof(
Label
), nameof(TextAlignmentElement.VerticalTextAlignmentProperty))]
Shell\BaseShellItem.cs (15)
329
flyoutItemCell.Children.OfType<
Label
>().First()
365
var defaultLabelClass = new Style(typeof(
Label
))
368
new Setter { Property =
Label
.VerticalTextAlignmentProperty, Value = TextAlignment.Center }
482
var
label = new Label();
483
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.TextProperty, Value = labelBinding });
500
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.FontSizeProperty, Value = 14 });
501
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.TextColorProperty, Value = textColor });
502
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.FontFamilyProperty, Value = "sans-serif-medium" });
503
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.MarginProperty, Value = new Thickness(20, 0, 0, 0) });
507
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.FontSizeProperty, Value = 14 });
508
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.FontAttributesProperty, Value = FontAttributes.Bold });
512
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.HorizontalOptionsProperty, Value = LayoutOptions.Start });
513
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.HorizontalTextAlignmentProperty, Value = TextAlignment.Start });
517
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.HorizontalOptionsProperty, Value = LayoutOptions.Start });
518
defaultLabelClass.Setters.Add(new Setter { Property =
Label
.HorizontalTextAlignmentProperty, Value = TextAlignment.Start });
TitleBar\TitleBar.cs (8)
428
var
titleLabel = new Label()
443
Label
.TextProperty,
448
Label
.TextColorProperty,
456
Property =
Label
.OpacityProperty,
465
Property =
Label
.OpacityProperty,
481
var
subtitleLabel = new Label()
497
Label
.TextProperty,
502
Label
.TextColorProperty,
ViewExtensions.cs (1)
418
if (element is
Label
label)
Microsoft.Maui.Controls.Compatibility (34)
iOS\Extensions\LabelExtensions.cs (1)
23
public static void RecalculateSpanPositions(this NativeLabel control,
Label
element)
iOS\Renderers\LabelRenderer.cs (33)
28
public class LabelRenderer : ViewRenderer<
Label
, NativeLabel>
40
Label
.TextProperty.PropertyName,
41
Label
.TextColorProperty.PropertyName,
42
Label
.FontAttributesProperty.PropertyName,
43
Label
.FontFamilyProperty.PropertyName,
44
Label
.FontSizeProperty.PropertyName,
45
Label
.FormattedTextProperty.PropertyName,
46
Label
.LineBreakModeProperty.PropertyName,
47
Label
.LineHeightProperty.PropertyName,
48
Label
.PaddingProperty.PropertyName,
49
Label
.TextTypeProperty.PropertyName
160
protected override void OnElementChanged(ElementChangedEventArgs<
Label
> e)
200
if (e.PropertyName ==
Label
.HorizontalTextAlignmentProperty.PropertyName)
202
else if (e.PropertyName ==
Label
.VerticalTextAlignmentProperty.PropertyName)
204
else if (e.PropertyName ==
Label
.TextColorProperty.PropertyName)
206
else if (e.PropertyName ==
Label
.FontAttributesProperty.PropertyName || e.PropertyName ==
Label
.FontFamilyProperty.PropertyName || e.PropertyName ==
Label
.FontSizeProperty.PropertyName)
212
else if (e.PropertyName ==
Label
.TextProperty.PropertyName)
218
else if (e.PropertyName ==
Label
.CharacterSpacingProperty.PropertyName)
220
else if (e.PropertyName ==
Label
.TextDecorationsProperty.PropertyName)
222
else if (e.PropertyName ==
Label
.FormattedTextProperty.PropertyName)
227
else if (e.PropertyName ==
Label
.LineBreakModeProperty.PropertyName)
231
else if (e.PropertyName ==
Label
.LineHeightProperty.PropertyName)
233
else if (e.PropertyName ==
Label
.MaxLinesProperty.PropertyName)
235
else if (e.PropertyName ==
Label
.PaddingProperty.PropertyName)
237
else if (e.PropertyName ==
Label
.TextTypeProperty.PropertyName)
239
else if (e.PropertyName ==
Label
.TextTransformProperty.PropertyName)
529
static bool FontIsDefault(
Label
label)
531
if (label.IsSet(
Label
.FontAttributesProperty))
536
if (label.IsSet(
Label
.FontFamilyProperty))
541
if (label.IsSet(
Label
.FontSizeProperty))
587
var textColor = (Color)Element.GetValue(
Label
.TextColorProperty);