Files
Common-VS2019/SacsMobileMaui/Maui/Controls/SamLabel.cs
T

79 lines
2.1 KiB
C#

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.
/// <summary>Default (initial) font size.</summary>
public double FontSizeDefault { get; private set; }
public new double FontSize
{
get { return fontSize; }
set { fontSize = value; base.FontSize = fontSize * fontSizeProportion; }
}
/// <summary>Font size proportion.</summary>
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;
}
}
//-------------------------------------------------------------------
}
//=======================================================================
}