public void OnBackButtonPress(object sender, BackButtonEventArgs e) { if (OnBackButton != null) { OnBackButton(sender, e); } }
private void Current_OnBackButton(object sender, BackButtonEventArgs e) { if (_viewModel.PickerIsOpen) { _viewModel.PickerIsOpen = false; e.Cancel = true; } }
public bool OnBackPressed() { var args = new BackButtonEventArgs(); if (BackPressed != null) { BackPressed(args); } return(args.Handled); }
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; } }
protected override bool OnBackButtonPressed() { var args = new BackButtonEventArgs(); OnBackButton(args); if (args.Cancel) { base.OnBackButtonPressed(); return(true); } else { return(false); } }
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(); } }
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); } } }
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; }; } }
protected virtual void OnBackButton(BackButtonEventArgs e) { BackButton?.Invoke(this, e); }
private void OnOnBackButton(BackButtonEventArgs e) { OnBackButton?.Invoke(this, e); }