diff --git a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyDatePicker/FreakyDatePickerHandler.cs b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyDatePicker/FreakyDatePickerHandler.cs
index 5dea449..8e1cd5c 100644
--- a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyDatePicker/FreakyDatePickerHandler.cs
+++ b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyDatePicker/FreakyDatePickerHandler.cs
@@ -12,18 +12,22 @@ public FreakyDatePickerHandler()
}
private void MapDatePicker(IDatePickerHandler datePickerHandler, IDatePicker datePicker)
- {
- if (datePicker is FreakyDatePicker freakyDatePicker &&
- datePickerHandler is FreakyDatePickerHandler freakyDatePickerHandler)
- {
- if (PlatformView is not null && VirtualView is not null)
- {
- if (freakyDatePicker.ImageSource != default(ImageSource))
- {
- freakyDatePickerHandler.HandleAndAlignImageSourceAsync(freakyDatePicker).RunConcurrently();
- }
- }
+ {
+ try
+ {
+ if (datePicker is FreakyDatePicker freakyDatePicker &&
+ datePickerHandler is FreakyDatePickerHandler freakyDatePickerHandler)
+ {
+ if (PlatformView is not null && VirtualView is not null)
+ {
+ if (freakyDatePicker.ImageSource != default(ImageSource))
+ {
+ freakyDatePickerHandler.HandleAndAlignImageSourceAsync(freakyDatePicker).RunConcurrently();
+ }
+ }
+ }
}
+ catch (Exception) { }
}
}
diff --git a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEditor/FreakyEditorHandler.cs b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEditor/FreakyEditorHandler.cs
index a32bc78..38cbb51 100644
--- a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEditor/FreakyEditorHandler.cs
+++ b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEditor/FreakyEditorHandler.cs
@@ -1,4 +1,4 @@
-using Microsoft.Maui.Handlers;
+using Microsoft.Maui.Handlers;
namespace Maui.FreakyControls;
@@ -11,16 +11,20 @@ public FreakyEditorHandler()
}
private void MapFreakyEditor(IEditorHandler editorHandler, IEditor editor)
- {
- if (editor is FreakyEditor feditor && editorHandler is FreakyEditorHandler freakyEditorHandler)
- {
- if (PlatformView is not null && VirtualView is not null)
- {
- HandleAllowCopyPaste(feditor);
- }
+ {
+ try
+ {
+ if (editor is FreakyEditor feditor && editorHandler is FreakyEditorHandler freakyEditorHandler)
+ {
+ if (PlatformView is not null && VirtualView is not null)
+ {
+ HandleAllowCopyPaste(feditor);
+ }
+ }
}
+ catch(Exception) { }
}
-}
+}
#else
public partial class FreakyEditorHandler : EditorHandler
{
diff --git a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEntry/FreakyEntryHandler.cs b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEntry/FreakyEntryHandler.cs
index 987dc10..000ea66 100644
--- a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEntry/FreakyEntryHandler.cs
+++ b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyEntry/FreakyEntryHandler.cs
@@ -1,4 +1,4 @@
-using Maui.FreakyControls.Extensions;
+using Maui.FreakyControls.Extensions;
using Microsoft.Maui.Handlers;
namespace Maui.FreakyControls;
@@ -14,17 +14,21 @@ public FreakyEntryHandler()
private void MapFreakyEntry(IEntryHandler entryHandler, IEntry entry)
{
- if (entry is FreakyEntry freakyEntry && entryHandler is FreakyEntryHandler freakyEntryHandler)
+ try
{
- if (PlatformView is not null && VirtualView is not null)
+ if (entry is FreakyEntry freakyEntry && entryHandler is FreakyEntryHandler freakyEntryHandler)
{
- if (freakyEntry.ImageSource != default(ImageSource))
+ if (PlatformView is not null && VirtualView is not null)
{
- freakyEntryHandler.HandleAndAlignImageSourceAsync(freakyEntry).RunConcurrently();
+ if (freakyEntry.ImageSource != default(ImageSource))
+ {
+ freakyEntryHandler.HandleAndAlignImageSourceAsync(freakyEntry).RunConcurrently();
+ }
+ HandleAllowCopyPaste(freakyEntry);
}
- HandleAllowCopyPaste(freakyEntry);
}
}
+ catch (Exception) { }
}
}
diff --git a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyPicker/FreakyPickerHandler.cs b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyPicker/FreakyPickerHandler.cs
index 07e948b..9ea26d3 100644
--- a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyPicker/FreakyPickerHandler.cs
+++ b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyPicker/FreakyPickerHandler.cs
@@ -13,17 +13,21 @@ public FreakyPickerHandler()
private void MapPicker(IPickerHandler pickerHandler, IPicker picker)
{
- if (picker is FreakyPicker freakyTimePicker &&
- pickerHandler is FreakyPickerHandler freakyTimePickerHandler)
+ try
{
- if (PlatformView is not null && VirtualView is not null)
+ if (picker is FreakyPicker freakyTimePicker &&
+ pickerHandler is FreakyPickerHandler freakyTimePickerHandler)
{
- if (freakyTimePicker.ImageSource != default(ImageSource))
+ if (PlatformView is not null && VirtualView is not null)
{
- freakyTimePickerHandler.HandleAndAlignImageSourceAsync(freakyTimePicker).RunConcurrently();
+ if (freakyTimePicker.ImageSource != default(ImageSource))
+ {
+ freakyTimePickerHandler.HandleAndAlignImageSourceAsync(freakyTimePicker).RunConcurrently();
+ }
}
}
}
+ catch (Exception) { }
}
}
#else
diff --git a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyTextInputLayout/FreakyTextInputLayout.xaml.cs b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyTextInputLayout/FreakyTextInputLayout.xaml.cs
index 6794acf..379acb6 100644
--- a/MAUI.FreakyControls/MAUI.FreakyControls/FreakyTextInputLayout/FreakyTextInputLayout.xaml.cs
+++ b/MAUI.FreakyControls/MAUI.FreakyControls/FreakyTextInputLayout/FreakyTextInputLayout.xaml.cs
@@ -10,7 +10,8 @@ public partial class FreakyTextInputLayout : ContentView, IDisposable
private int _leftMargin;
private double _placeholderFontSize = 18;
private double _titleFontSize = 14;
-
+ private bool _isLoading;
+
public FreakyTextInputLayout()
{
InitializeComponent();
@@ -696,7 +697,7 @@ private static void BorderTypePropertyChanged(BindableObject bindable, object ol
private static void OnOutlineTitleBackgroundColorProperty(BindableObject bindable, object oldValue, object newValue)
{
- if (bindable is FreakyTextInputLayout til && newValue is Color color)
+ if (bindable is FreakyTextInputLayout til && newValue is Color color && til.LabelTitle is not null)
{
til.LabelTitle.BackgroundColor = til.BorderType ==
BorderType.Outlined ? color : Colors.Transparent;
@@ -755,8 +756,9 @@ private static void OnImageWidthChanged(BindableObject bindable, object oldValue
private async void Handle_Focused(object sender, FocusEventArgs e)
{
- if (string.IsNullOrEmpty(Text))
+ if (string.IsNullOrEmpty(Text) && LabelTitle.Height > 0)
{
+ //don't transition if labeltitle height is 0 (not initialized fully)
await TransitionToTitle(true);
}
}
@@ -791,6 +793,8 @@ private async Task TransitionToTitle(bool animated)
LabelTitle.TranslationY = yoffset;
LabelTitle.FontSize = _titleFontSize;
}
+
+ _isLoading = false;
}
private async Task TransitionToPlaceholder(bool animated)
@@ -866,9 +870,15 @@ private void HiddenTitle_OnPropertyChanged(object sender, PropertyChangedEventAr
private async void EntryField_OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == nameof(Height) && !string.IsNullOrEmpty(EntryField?.Text))
+ if (e.PropertyName == nameof(IsFocused) && LabelTitle.Height <= 0)
+ {
+ //entry receives focus before it is fully initialized (0 height)
+ _isLoading = true;
+ }
+ else if (e.PropertyName == nameof(Height) && (!string.IsNullOrEmpty(EntryField?.Text) || _isLoading))
{
- //Make label floating if the entry field already has text it in when it is loaded
+ //Make label floating if the entry field already has text in it when it is loaded or
+ // has focus when the app starts (if focus is applied on app load)
await TransitionToTitle(false);
}
}
diff --git a/MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj b/MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj
index c57160f..977cebb 100644
--- a/MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj
+++ b/MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj
@@ -84,6 +84,7 @@
+
@@ -98,7 +99,6 @@
-
@@ -139,15 +139,20 @@
-
+
-
-
+
+
+
+
+
+
-
+
+
@@ -165,8 +170,8 @@
-
- true
-
+
+ true
+
-
+
\ No newline at end of file
diff --git a/MAUI.FreakyControls/Samples/Samples.csproj b/MAUI.FreakyControls/Samples/Samples.csproj
index 61f0f91..75d1f64 100644
--- a/MAUI.FreakyControls/Samples/Samples.csproj
+++ b/MAUI.FreakyControls/Samples/Samples.csproj
@@ -87,8 +87,8 @@
-
-
+
+