Improve shared MAUI controls and tests

This commit is contained in:
Andy Howard
2026-10-06 14:13:28 +01:00
parent 0406adfc99
commit 5daf7ce97f
106 changed files with 2299 additions and 805 deletions
+18 -18
View File
@@ -1,4 +1,4 @@
using Sarand.Net.Mobile.Maui.App;
using Sarand.Net.Mobile.Maui.App;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
@@ -8,19 +8,15 @@ using System.Threading.Tasks;
namespace Sarand.Net.Mobile.Maui.Controls
{
//=======================================================================
public class SamEditor : Editor
public class SamEditor : Editor, ISamNativeControlStyle, ISamControl
{
//-------------------------------------------------------------------
// Definitions.
// --- Data Members ---
//-------------------------------------------------------------------
// Data members.
private bool trimTextOnCompletion = true;
private int NumberOfLinesPrevious = 0;
//-------------------------------------------------------------------
// Construction.
// --- Construction ---
public SamEditor()
{
DefaultFontSize = FontSize;
@@ -29,8 +25,15 @@ namespace Sarand.Net.Mobile.Maui.Controls
Completed += SamEditor_Completed;
}
//-------------------------------------------------------------------
// Properties.
// --- Component state ---
public void SetControlActivity(bool enabled)
{
if (IsEnabled != enabled) IsEnabled = enabled;
}
// --- Properties ---
public double DefaultFontSize { get; }
@@ -44,14 +47,13 @@ namespace Sarand.Net.Mobile.Maui.Controls
}
}
// Native behaviour modified by SamHandler.
// --- Native styling ---
public bool NativeNoBorder { get; set; } = Sam.Visuals.Form.Controls.NativeNoBorder;
public bool NativeNoUnderline { get; set; } = Sam.Visuals.Form.Controls.NativeNoUnderline;
public bool NativeBackgroundClear { get; set; } = Sam.Visuals.Form.Controls.NativeBackgroundClear;
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
// --- Control events ---
// Key Press event is not supported directly in Xamarin.
// Requires O/S specific implementation.
// See: Sarand.LogisticsMgr.Mobile.Droid.Forms.Renderers.SlmEditorRenderer
@@ -60,7 +62,6 @@ namespace Sarand.Net.Mobile.Maui.Controls
// Resize control based on entered text.
InvalidateMeasure();
}
//-------------------------------------------------------------------
private void SamEditor_TextChanged(object? sender, TextChangedEventArgs e)
{
// If the number of lines of text has changed, resize the control.
@@ -78,7 +79,6 @@ namespace Sarand.Net.Mobile.Maui.Controls
InvalidateMeasure();
}
//-------------------------------------------------------------------
// --- The End ---
}
//=======================================================================
}