I have an app that gets input from a HID barcode scanner where I need to always keep the focus on an Entry control.
I have it working using a timer but I would like a cleaner solution.
I read everything I can find on the Entry control but found no information on how I might do this.
This is what I have working.
public MainPage()
{
InitializeComponent();
var KeepFocusTimer = Application.Current.Dispatcher.CreateTimer();
KeepFocusTimer.Interval = TimeSpan.FromSeconds(10);
KeepFocusTimer.Tick += (s, e) => OnKeepFocusTimer();
KeepFocusTimer.Start();
}
void OnKeepFocusTimer()
{
MainThread.BeginInvokeOnMainThread(() =>
{
tx_BarCodeNumber.Focus();
});
}