public Login() { this.InitializeComponent(); mainPage = (App.Current as App).MainPage; names = LocalUtils.AllUserNames()?.ToList() ?? new List <string>(); NameBox.TextChanged += (sender, e) => { if (e.Reason == AutoSuggestionBoxTextChangeReason.UserInput) { var txt = sender.Text; sender.ItemsSource = names.Where(item => item.StartsWith(txt)).ToList(); } LoginButton.IsEnabled = !String.IsNullOrWhiteSpace(NameBox.Text) && !String.IsNullOrEmpty(PasswordBox.Password); }; NameBox.SuggestionChosen += (sender, e) => { var name = e.SelectedItem as string; User u; if (LocalUtils.TryGetUser(name, out u)) { SetUser(u); } }; PasswordBox.PasswordChanged += (sender, e) => { LoginButton.IsEnabled = !String.IsNullOrWhiteSpace(NameBox.Text) && !String.IsNullOrEmpty(PasswordBox.Password); }; }