Files
Common-VS2019/SacsMobileMaui/Maui/Views/SamContentView.cs
T

72 lines
1.9 KiB
C#

using Sarand.Net.Mobile.Maui.Utils;
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.Views
{
//=======================================================================
public class SamContentView : ContentView, ISamView
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
private bool readOnly = false;
//-------------------------------------------------------------------
// Construction.
public SamContentView()
{
}
//-------------------------------------------------------------------
// Properties.
public Page? GetPage() { return SamElementUtil.GetPage(this); }
public bool ReadOnly
{
get { return readOnly; }
set { if (readOnly == value) return; readOnly = value; SetControlActivity(IsEnabled); }
}
//-------------------------------------------------------------------
// Configure components.
public virtual void ConfigureComponents()
{
}
//-------------------------------------------------------------------
// Control activity.
public virtual void SetControlActivity(bool enabled)
{
if (IsEnabled != enabled) IsEnabled = enabled;
SetControlsReadOnly();
}
public virtual void SetControlsReadOnly()
{
}
//-------------------------------------------------------------------
// View events.
protected override void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
base.OnPropertyChanged(propertyName);
if (propertyName.EqualsCI(IsEnabledProperty.PropertyName))
{
SetControlActivity(IsEnabled);
}
}
//-------------------------------------------------------------------
}
//=======================================================================
}