Esempio n. 1
0
 public void OnBackButtonPress(object sender, BackButtonEventArgs e)
 {
     if (OnBackButton != null)
     {
         OnBackButton(sender, e);
     }
 }
Esempio n. 2
0
 private void Current_OnBackButton(object sender, BackButtonEventArgs e)
 {
     if (_viewModel.PickerIsOpen)
     {
         _viewModel.PickerIsOpen = false;
         e.Cancel = true;
     }
 }
Esempio n. 3
0
        public bool OnBackPressed()
        {
            var args = new BackButtonEventArgs();

            if (BackPressed != null)
            {
                BackPressed(args);
            }
            return(args.Handled);
        }
Esempio n. 4
0
        public void HandleDelete(object sender, BackButtonEventArgs e)
        {
            var entry   = sender as BorderlessEntry;
            var entries = InputContainer.Children;

            if (String.IsNullOrEmpty(e.OldValue) || (MostRecentBackPress != null && MostRecentBackPress.OldValue == e.OldValue))
            {
                FocusBack(entries, entry, true);
            }
            else
            {
                MostRecentBackPress = e;
            }
        }
Esempio n. 5
0
        protected override bool OnBackButtonPressed()
        {
            var args = new BackButtonEventArgs();

            OnBackButton(args);
            if (args.Cancel)
            {
                base.OnBackButtonPressed();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            if (Element == null)
            {
                return;
            }

            if (Control != null)
            {
                Control.Layer.BorderWidth = 0;
                Control.BorderStyle       = UITextBorderStyle.None;
                Control.VerticalAlignment = UIControlContentVerticalAlignment.Center;
            }

            var entry = (BorderlessEntry)Element;

            entry.TextChanged += (sender, ev) =>
            {
                OldValue = ev.OldTextValue;
                NewValue = ev.NewTextValue;
            };
            var textField = new CustomTextField();

            textField.EditingChanged      += OnEditingChanged;
            textField.OnDeleteBackwardKey += (sender, ev) =>
            {
                if (TheEvent != null)
                {
                    if (OldValue == TheEvent.OldValue)
                    {
                        OldValue = "";
                    }
                }
                TheEvent = new BackButtonEventArgs(NewValue, OldValue);
                entry.OnBackButtonPress(entry, TheEvent);
            };

            SetNativeControl(textField);

            base.OnElementChanged(e);

            if (Element.Keyboard != null && Element.Keyboard == Keyboard.Numeric)
            {
                AddDoneButton();
            }
        }
Esempio n. 7
0
        private void FocusBack(Grid.IGridList <View> entries, BorderlessEntry e, bool deleteValue = false)
        {
            MostRecentBackPress = null;
            int index = entries.IndexOf(e);

            if (index > -1 && (index - 1) >= 0)
            {
                var prev  = (BorderlessEntry)entries.ElementAt(index - 1);
                var input = prev.Text;
                prev?.Focus();
                if (deleteValue)
                {
                    prev.Text           = "";
                    MostRecentBackPress = new BackButtonEventArgs("", input);
                }
            }
        }
Esempio n. 8
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                Control.Background = null;
            }

            if (e.NewElement != null)
            {
                var entry = e.NewElement as BorderlessEntry;

                ((EditText)Control).KeyPress += (sender, ev) =>
                {
                    ev.Handled = false;
                    if (ev.KeyCode == Keycode.Del)
                    {
                        if (TheEvent != null)
                        {
                            if (OldValue == TheEvent.OldValue)
                            {
                                OldValue = "";
                            }
                        }
                        TheEvent = new BackButtonEventArgs(NewValue, OldValue);
                        entry.OnBackButtonPress(entry, TheEvent);
                        ev.Handled = true;
                    }
                };

                entry.TextChanged += (sender, args) =>
                {
                    OldValue = args.OldTextValue;
                    NewValue = args.NewTextValue;
                };
            }
        }
Esempio n. 9
0
 protected virtual void OnBackButton(BackButtonEventArgs e)
 {
     BackButton?.Invoke(this, e);
 }
Esempio n. 10
0
 private void OnOnBackButton(BackButtonEventArgs e)
 {
     OnBackButton?.Invoke(this, e);
 }