Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing FontSize properties to InputFields #469

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/UraniumUI.Material/Controls/InputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,5 +419,16 @@ protected virtual void OnCornerRadiusChanged()
typeof(InputField),
defaultValue: 8.0,
propertyChanged: (bindable, oldValue, newValue) => (bindable as InputField).OnCornerRadiusChanged());

[System.ComponentModel.TypeConverter(typeof(FontSizeConverter))]
public double TitleFontSize { get => (double)GetValue(TitleFontSizeProperty); set => SetValue(TitleFontSizeProperty, value); }

public static readonly BindableProperty TitleFontSizeProperty = BindableProperty.Create(
nameof(TitleFontSize),
typeof(double),
typeof(InputField),
defaultValue: Label.FontSizeProperty.DefaultValue,
propertyChanged: (bindable, oldValue, newValue) => (bindable as InputField).labelTitle.FontSize = (double)newValue
);
#endregion
}
1 change: 0 additions & 1 deletion src/UraniumUI.Material/Controls/PickerField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,5 @@ public override void ResetValidation()
nameof(SelectedValueChangedCommand),
typeof(ICommand), typeof(PickerField),
defaultValue: null);

#endregion
}
17 changes: 12 additions & 5 deletions src/UraniumUI.Material/Controls/TextField.BindableProperties.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using InputKit.Shared.Abstraction;
using InputKit.Shared.Validations;
using Microsoft.Maui.Converters;
using Microsoft.Maui.Converters;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using System.Windows.Input;
using UraniumUI.Resources;

Expand Down Expand Up @@ -150,4 +146,15 @@ public partial class TextField
typeof(bool),
typeof(TextField),
false);

[System.ComponentModel.TypeConverter(typeof(FontSizeConverter))]
public double FontSize { get => (double)GetValue(FontSizeProperty); set => SetValue(FontSizeProperty, value); }

public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(
nameof(FontSize),
typeof(double),
typeof(InputField),
defaultValue: Label.FontSizeProperty.DefaultValue,
propertyChanged: (bindable, oldValue, newValue) => (bindable as TextField).EntryView.FontSize = (double)newValue
);
}
1 change: 0 additions & 1 deletion src/UraniumUI.Material/Controls/TextField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public TextField()
iconClear.TappedCommand = new Command(OnClearTapped);

UpdateClearIconState();

EntryView.SetBinding(Entry.TextProperty, new Binding(nameof(Text), source: this));
EntryView.SetBinding(Entry.ReturnCommandParameterProperty, new Binding(nameof(ReturnCommandParameter), source: this));
EntryView.SetBinding(Entry.ReturnCommandProperty, new Binding(nameof(ReturnCommand), source: this));
Expand Down