private void RayzTb_TextChanged(object sender, TextChangedEventArgs e) { if (RayzTb.Text.Length > 0) { var shown = false; foreach (var c in RayzTb.Text.ToCharArray().Where(c => c > 9000)) { var curretPos = RayzTb.SelectionStart - 1; RayzTb.Text = RayzTb.Text.Replace(c.ToString(CultureInfo.InvariantCulture), ""); RayzTb.Select(curretPos, 0); if (shown) { continue; } MessageBox.Show("These emotions are not supported by the current version.", "Sorry", MessageBoxButton.OK); shown = true; } } Deployment.Current.Dispatcher.BeginInvoke(() => { if (ApplicationBar != null) { ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = RayzTb.Text.Length > 0; ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = !String.IsNullOrWhiteSpace(RayzTb.Text); } }); }
private void FocusTextBox() { RayzTb.Focus(); if (RayzTb.Text.Equals(String.Empty)) { RayzTb.Text = " "; RayzTb.Text = ""; } }