Skip to content

Commit

Permalink
Merge pull request #469 from enisn/2.6-fontsize
Browse files Browse the repository at this point in the history
Add missing FontSize properties to InputFields
  • Loading branch information
enisn authored Oct 21, 2023
2 parents e4ec45a + b626ce4 commit c1a56a0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
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

0 comments on commit c1a56a0

Please sign in to comment.