Skip to content

Commit 4e3729a

Browse files
committed
Merge branch 'Feature/31-AddFocusMethodToFloatingLabelControl' into develop
2 parents 8ac87d7 + 744807c commit 4e3729a

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

NControl.Controls/NControl.Controls/FloatingLabelControl.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ public FloatingLabelControl ()
129129
if(Focused != null)
130130
Focused(this, e);
131131
};
132-
133-
_textEntry.Unfocused += (object sender, FocusEventArgs e) =>
132+
133+
_textEntry.Unfocused += (object sender, FocusEventArgs e) =>
134134
{
135135
UpdatePlaceholderColor();
136136

@@ -238,6 +238,26 @@ private void TextEntry_TextChanged (object sender, TextChangedEventArgs e)
238238

239239
#endregion
240240

241+
#region Public Members
242+
243+
/// <summary>
244+
/// Focus this instance.
245+
/// </summary>
246+
public new void Focus()
247+
{
248+
_textEntry.Focus();
249+
}
250+
251+
/// <summary>
252+
/// Unfocus this instance.
253+
/// </summary>
254+
public new void Unfocus()
255+
{
256+
_textEntry.Unfocus();
257+
}
258+
259+
#endregion
260+
241261
#region Properties
242262
/// <summary>
243263
/// The TextColor property.
@@ -592,7 +612,7 @@ public bool IsPassword
592612
}
593613
}
594614

595-
#endregion
615+
#endregion
596616

597617
#region Private Members
598618

NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/FloatingLabelPage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ protected override void OnAppearing ()
1717
var entry1 = new FloatingLabelControl{ Placeholder = "Email", Keyboard = Keyboard.Email };
1818
entry1.SetBinding (FloatingLabelControl.TextProperty, "Title", BindingMode.TwoWay);
1919
entry1.BindingContext = this;
20+
entry1.Focus();
2021

2122
var entry2 = new FloatingLabelControl { Placeholder = "First name", Keyboard = Keyboard.Text };
2223
var entry3 = new FloatingLabelControl { Placeholder = "Last name", Keyboard = Keyboard.Text };

0 commit comments

Comments
 (0)