示例#1
0
        public void InputEntry_Completed(object sender, EventArgs e)
        {
            if (viewModel.InputText.Length > 0 || App.InputEmptyAllowed)
            {
                if (!App.FinishInputSet)                         // Xamarin Forms bug workaround ???
                {
                    App.FinishInputSet = true;

                    if (viewModel.InputText.Length == 0 && App.InputEmptyVal != null)
                    {
                        SetInputTextNoEvents(App.InputEmptyVal);
                    }

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (!App.SettingsViewModel.KeepKeyboardVisible)
                        {
                            InputEntry.Unfocus();
                        }

                        App.FinishInput.Set();
                    });
                }
            }
            else                        // never reached, but just in case
            {
                Device.StartTimer(new TimeSpan(0, 0, 0, 0, 250), () =>
                {
                    InputEntry.Focus();

                    return(false);
                });
            }
        }
示例#2
0
        private void List_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }

            ListBox list = (sender as ListBox);

            var selectedItem = e.AddedItems.First();

            if (selectedItem is Token)
            {
                Evaluate(selectedItem as Token);
            }
            else
            {
                string insertText = (e.AddedItems.First() as dynamic).Key;
                InputEntry.SelectedText    = insertText;
                InputEntry.SelectionStart  = InputEntry.SelectionStart + InputEntry.SelectionLength;
                InputEntry.SelectionLength = 0;
            }
            InputEntry.Focus(FocusState.Pointer);
            list.SelectedIndex = -1;
        }
示例#3
0
 public void SpellButton_Clicked(object sender, EventArgs e)
 {
     currentWord = InputEntry.Text;
     if (!String.IsNullOrEmpty(currentWord))
     {
         SetWord();
     }
     else
     {
         InputEntry.Focus();
     }
 }
示例#4
0
        private void OutputTapped(object sender, EventArgs e)
        {
            InputEntry.IsVisible  = true;
            SpellButton.IsVisible = true;

            OutputLabel.IsVisible = false;
            LettersView.IsVisible = false;

            InputEntry.Focus();

            LettersView.Position = 0;
        }
        public TextInputCancellableView(string titleText, string placeHolderText,
                                        string saveButtonText, string cancelButtonText, string validationText)
        {
            InitializeComponent();

            // update the Element's textual values
            TitleLabel.Text = titleText;
            //InputEntry.Placeholder = placeHolderText;
            SaveButton.Text      = saveButtonText;
            CancelButton.Text    = cancelButtonText;
            ValidationLabel.Text = validationText;

            // handling events to expose to public
            SaveButton.Clicked     += SaveButton_Clicked;
            CancelButton.Clicked   += CancelButton_Clicked;
            InputEntry.TextChanged += InputEntry_TextChanged;
            InputEntry.Focus();
        }