Improve shared MAUI controls and tests
This commit is contained in:
@@ -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 ---
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user