diff --git a/NControl.Controls/NControl.Controls/FloatingLabelControl.cs b/NControl.Controls/NControl.Controls/FloatingLabelControl.cs index 97bcfbb..ac3b9d0 100644 --- a/NControl.Controls/NControl.Controls/FloatingLabelControl.cs +++ b/NControl.Controls/NControl.Controls/FloatingLabelControl.cs @@ -129,8 +129,8 @@ public FloatingLabelControl () if(Focused != null) Focused(this, e); }; - - _textEntry.Unfocused += (object sender, FocusEventArgs e) => + + _textEntry.Unfocused += (object sender, FocusEventArgs e) => { UpdatePlaceholderColor(); @@ -238,6 +238,26 @@ private void TextEntry_TextChanged (object sender, TextChangedEventArgs e) #endregion + #region Public Members + + /// + /// Focus this instance. + /// + public new void Focus() + { + _textEntry.Focus(); + } + + /// + /// Unfocus this instance. + /// + public new void Unfocus() + { + _textEntry.Unfocus(); + } + + #endregion + #region Properties /// /// The TextColor property. @@ -592,7 +612,7 @@ public bool IsPassword } } - #endregion + #endregion #region Private Members diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/FloatingLabelPage.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/FloatingLabelPage.cs index 933a1c9..e22a321 100644 --- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/FloatingLabelPage.cs +++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/FloatingLabelPage.cs @@ -17,6 +17,7 @@ protected override void OnAppearing () var entry1 = new FloatingLabelControl{ Placeholder = "Email", Keyboard = Keyboard.Email }; entry1.SetBinding (FloatingLabelControl.TextProperty, "Title", BindingMode.TwoWay); entry1.BindingContext = this; + entry1.Focus(); var entry2 = new FloatingLabelControl { Placeholder = "First name", Keyboard = Keyboard.Text }; var entry3 = new FloatingLabelControl { Placeholder = "Last name", Keyboard = Keyboard.Text };