using Sarand.Net.Standard.Base.Utils; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace Sarand.Net.Mobile.Maui.Controls { //======================================================================= public class SamLabel : Label { //------------------------------------------------------------------- // Definitions. //------------------------------------------------------------------- // Data members. private double fontSize; private double fontSizeProportion = 1.0; //------------------------------------------------------------------- // Construction. public SamLabel() { fontSize = base.FontSize; FontSizeDefault = fontSize; Text = ""; } //------------------------------------------------------------------- // Properties. /// Default (initial) font size. public double FontSizeDefault { get; private set; } public new double FontSize { get { return fontSize; } set { fontSize = value; base.FontSize = fontSize * fontSizeProportion; } } /// Font size proportion. public double FontSizeProportion { get { return fontSizeProportion; } set { fontSizeProportion = value; base.FontSize = fontSize * fontSizeProportion; } } //------------------------------------------------------------------- // Control events. //------------------------------------------------------------------- // View events. protected override void OnPropertyChanging([CallerMemberName] string propertyName = "") { base.OnPropertyChanging(propertyName); if (propertyName.EqualsCI("FontSize")) { } } protected override void OnPropertyChanged([CallerMemberName] string propertyName = "") { base.OnPropertyChanged(propertyName); if (propertyName.EqualsCI("FontSize")) { if (FontSizeDefault <= 0) FontSizeDefault = base.FontSize; fontSize = base.FontSize; } } //------------------------------------------------------------------- } //======================================================================= }