diff --git a/NControl.Controls/NControl.Controls/ActionButton.cs b/NControl.Controls/NControl.Controls/ActionButton.cs
index a0fe814..6757f8c 100644
--- a/NControl.Controls/NControl.Controls/ActionButton.cs
+++ b/NControl.Controls/NControl.Controls/ActionButton.cs
@@ -213,9 +213,9 @@ public Color ButtonColor
});
///
- /// Gets or sets the color of the buton.
+ /// Gets or sets the button font family.
///
- /// The color of the buton.
+ /// The button font family.
public string ButtonFontFamily
{
get { return (string)GetValue (ButtonFontFamilyProperty);}
@@ -249,9 +249,58 @@ public string ButtonIcon
}
///
- /// The button icon property.
+ /// The button icon font size property.
+ ///
+ public static BindableProperty ButtonIconFontSizeProperty =
+ BindableProperty.Create(nameof(ButtonIconFontSize), typeof(double), typeof(ActionButton), (double)14,
+ BindingMode.TwoWay, null, (bindable, oldValue, newValue) =>
+ {
+ var ctrl = (ActionButton)bindable;
+ ctrl.ButtonIconFontSize = (double)newValue;
+ });
+
+ ///
+ /// Gets or sets the size of the button icon font.
+ ///
+ /// The size of the button icon font.
+ public double ButtonIconFontSize
+ {
+ get { return (double)GetValue(ButtonIconFontSizeProperty); }
+ set
+ {
+ SetValue(ButtonIconFontSizeProperty, value);
+ ButtonIconLabel.FontSize = (double)value;
+ }
+ }
+
+ ///
+ /// The button icon font size auto property.
+ ///
+ public static BindableProperty ButtonIconFontSizeAutoProperty =
+ BindableProperty.Create(nameof(ButtonIconFontSizeAuto), typeof(bool), typeof(ActionButton), (bool)false,
+ BindingMode.TwoWay, null, (bindable, oldValue, newValue) =>
+ {
+ var ctrl = (ActionButton)bindable;
+ ctrl.ButtonIconFontSizeAuto = (bool)newValue;
+ });
+
+ ///
+ /// Gets or sets the automatic sizing of the button icon font size.
+ ///
+ /// The size of the button icon auto font.
+ public bool ButtonIconFontSizeAuto
+ {
+ get { return (bool)GetValue(ButtonIconFontSizeAutoProperty); }
+ set
+ {
+ SetValue(ButtonIconFontSizeAutoProperty, value);
+ }
+ }
+
+ ///
+ /// The has shadow property.
///
- public static BindableProperty HasShadowProperty =
+ public static BindableProperty HasShadowProperty =
BindableProperty.Create(nameof(HasShadow), typeof(bool), typeof(ActionButton), true,
BindingMode.TwoWay, null, (bindable, oldValue, newValue) => {
var ctrl = (ActionButton)bindable;
@@ -391,7 +440,35 @@ public override bool TouchesEnded (System.Collections.Generic.IEnumerable
+ ///
+ /// Lays out the children.
+ ///
+ /// The children.
+ /// The x coordinate.
+ /// The y coordinate.
+ /// Width.
+ /// Height.
+ protected override void LayoutChildren(double x, double y, double width, double height)
+ {
+ base.LayoutChildren(x, y, width, height);
+
+ if (ButtonIconFontSizeAuto)
+ {
+ //TODO: Improve the calculations for Auto FontSizing ratios
+ if (width > 0 && width < 32)
+ ButtonIconFontSize = width / 4;
+ if (width >= 32 && width < 64)
+ ButtonIconFontSize = width / 3.5;
+ if (width > 64 && width < 96)
+ ButtonIconFontSize = width / 3;
+ if (width >= 96 && width < 128)
+ ButtonIconFontSize = width / 2.5;
+ if (width >= 128)
+ ButtonIconFontSize = width / 2;
+ }
+ }
+
+ ///
/// On Measure
///
///
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/ActionButtonPage.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/ActionButtonPage.cs
index f99cf03..55db77e 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/ActionButtonPage.cs
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/ActionButtonPage.cs
@@ -23,15 +23,17 @@ protected override void OnAppearing ()
var ab = new ActionButton {
ButtonColor = Color.FromHex("#E91E63"),
ButtonIcon = FontAwesomeLabel.FAThumbsUp,
+ ButtonIconFontSize = 18,
};
layout.Children.Add(ab, () => new Rectangle((layout.Width/4)-(56/2), (layout.Height/2)-(56/2), 56, 56));
var abtgl = new ToggleActionButton {
ButtonColor = Color.FromHex("#FF5722"),
ButtonIcon = FontAwesomeLabel.FAPlus,
+ ButtonIconFontSizeAuto = true,
};
abtgl.SetBinding (IsToggledProperty, "IsToggled");
- layout.Children.Add(abtgl, () => new Rectangle((layout.Width/2)-(56/2), (layout.Height/2)-(56/2), 56, 56));
+ layout.Children.Add(abtgl, () => new Rectangle((layout.Width / 2) - (56 / 2), (layout.Height / 2) - (56 / 2), 84, 84));
_command = new Command ((obj) => {}, (obj) => abtgl.IsToggled);
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs
index 0d20eae..e962f96 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs
@@ -19,17 +19,17 @@ protected override void OnAppearing ()
Pages = {
new Button {
Command = new Command((obj)=>wizard.Page++),
- Text = "Page 2",
+ Text = "Page 1",
},
new Button {
Command = new Command((obj)=>wizard.Page++),
- Text = "Page 3",
+ Text = "Page 2",
},
new Button {
Command = new Command((obj)=>wizard.Page++),
- Text = "Page 4",
+ Text = "Page 3",
},
new Button {
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml
index 119a76c..274c887 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml
@@ -1,15 +1,13 @@
-
-
+
+
-
+
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs
index fe5b148..90225d4 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs
@@ -12,5 +12,10 @@ public WizardPageXaml()
InitializeComponent();
Title = "WizardLayout XAML";
}
+
+ void Handle_Clicked(object sender, System.EventArgs e)
+ {
+ this.wizard.Page++;
+ }
}
}