I want to load some data from server, and then set the focus to a SearchBar control.
I have created a custom control with a bindable property, checking the value received, and if true, I call Focus() method, but it doesn't work.
Here is my code:
public class AppSearchBar : SearchBar
{
public static readonly BindableProperty RaiseFocusProperty =
BindableProperty.Create<AppSearchBar, bool>(p => p.RaiseFocus, default(bool));
public bool RaiseFocus
{
get { return (bool)GetValue(RaiseFocusProperty); }
set
{
if (value)
this.Focus();
SetValue(RaiseFocusProperty, value);
}
}
}
What can I do?