diff options
Diffstat (limited to 'Xamarin.Forms.Core/Label.cs')
-rw-r--r-- | Xamarin.Forms.Core/Label.cs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Xamarin.Forms.Core/Label.cs b/Xamarin.Forms.Core/Label.cs index a6390b2d..0634e080 100644 --- a/Xamarin.Forms.Core/Label.cs +++ b/Xamarin.Forms.Core/Label.cs @@ -7,17 +7,19 @@ namespace Xamarin.Forms { [ContentProperty("Text")] [RenderWith(typeof(_LabelRenderer))] - public class Label : View, IFontElement + public class Label : View, IFontElement, IElementConfiguration<Label> { public static readonly BindableProperty HorizontalTextAlignmentProperty = BindableProperty.Create("HorizontalTextAlignment", typeof(TextAlignment), typeof(Label), TextAlignment.Start, propertyChanged: OnHorizontalTextAlignmentPropertyChanged); - [Obsolete("XAlignProperty is obsolete. Please use HorizontalTextAlignmentProperty instead.")] public static readonly BindableProperty XAlignProperty = HorizontalTextAlignmentProperty; + [Obsolete("XAlignProperty is obsolete. Please use HorizontalTextAlignmentProperty instead.")] + public static readonly BindableProperty XAlignProperty = HorizontalTextAlignmentProperty; public static readonly BindableProperty VerticalTextAlignmentProperty = BindableProperty.Create("VerticalTextAlignment", typeof(TextAlignment), typeof(Label), TextAlignment.Start, propertyChanged: OnVerticalTextAlignmentPropertyChanged); - [Obsolete("YAlignProperty is obsolete. Please use VerticalTextAlignmentProperty instead.")] public static readonly BindableProperty YAlignProperty = VerticalTextAlignmentProperty; + [Obsolete("YAlignProperty is obsolete. Please use VerticalTextAlignmentProperty instead.")] + public static readonly BindableProperty YAlignProperty = VerticalTextAlignmentProperty; public static readonly BindableProperty TextColorProperty = BindableProperty.Create("TextColor", typeof(Color), typeof(Label), Color.Default); @@ -50,6 +52,13 @@ namespace Xamarin.Forms public static readonly BindableProperty LineBreakModeProperty = BindableProperty.Create("LineBreakMode", typeof(LineBreakMode), typeof(Label), LineBreakMode.WordWrap, propertyChanged: (bindable, oldvalue, newvalue) => ((Label)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged)); + readonly Lazy<PlatformConfigurationRegistry<Label>> _platformConfigurationRegistry; + + public Label() + { + _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Label>>(() => new PlatformConfigurationRegistry<Label>(this)); + } + bool _cancelEvents; [Obsolete("Please use the Font attributes which are on the class itself. Obsoleted in v1.3.0")] @@ -284,5 +293,10 @@ namespace Xamarin.Forms label.OnPropertyChanged(nameof(YAlign)); #pragma warning restore 0618 } + + public IPlatformElementConfiguration<T, Label> On<T>() where T : IConfigPlatform + { + return _platformConfigurationRegistry.Value.On<T>(); + } } }
\ No newline at end of file |