private void BuildStep2() { this.Children.Clear(); var label = new CustomLabel() { Text = "We have sent a confirmation code to the mobile number below. Please enter the confirmation code.", TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Margin = new Thickness(20), HeightRequest = 70 }; this.Children.Add(label); phoneNumberEntry.Focused += (o, a) => { codeEntry.Focus(); }; this.Children.Add(phoneNumberEntry); this.Children.Add(UIUtils.MakeSeparator()); codeEntry = UIUtils.MakeEntry("Confirmation code", UIUtils.FONT_SFUIDISPLAY_BOLD); this.Children.Add(codeEntry); this.Children.Add(UIUtils.MakeSeparator()); this.Children.Add(continueButton); this.ForceLayout(); this.currentStep = 2; }
void OnButtonVehicle(object sender, EventArgs args) { btnVehicle.IsVisible = false; entryVehicle.IsVisible = true; isDirty = true; entryVehicle.Focus(); Analytics.TrackEventProfile(Analytics.EVENT_PPROFILE_VEHICLE); }
protected override void OnAppearing() { Analytics.TrackPage(Analytics.PAGE_RUNADJUST); Device.StartTimer(TimeSpan.FromMilliseconds(50), () => // Focus() is not reliable if called immediately { if (isPinAccepted == false) { entry.Focus(); // pop up soft keyboard to enter pin } return(false); // stop timer }); }
string SearchControl(string controlID, string action, string content) { foreach (View t in grid.Children) { if (t.StyleId == controlID) { var stack = (StackLayout)t; foreach (View v in stack.Children) { if (v.StyleId == controlID) { string type = v.GetType().ToString(); if (type == "ASolute_Mobile.CustomRenderer.CustomEntry") { CustomEntry entry = (CustomEntry)v; switch (action) { case "GetValue": return(entry.Text); case "SetValue": entry.Text = content; break; case "Focus": entry.Focus(); break; default: entry.Text = String.Empty; break; } } else if (type == "ASolute_Mobile.CustomRenderer.CustomDatePicker") { CustomDatePicker picker = (CustomDatePicker)v; switch (action) { case "GetValue": if (picker.NullableDate == null) { return(""); } else { return(picker.Date.ToString("yyyy-MM-dd")); } case "Focus": picker.Focus(); break; default: if (picker.NullableDate != null) { picker.Date = DateTime.Now; picker.NullableDate = null; } break; } } } } } } return(null); }
private void CriarPagina() { var alturaTela = Height; var paddingTela = alturaTela * .05f; var alturaLogo = alturaTela * .65f; var alturaMarginTopTextos = alturaTela * .1f; var alguraTextos = alturaTela * .3f; Padding = new Thickness(0, 0, 0, paddingTela); BackgroundColor = COR_BACKGROUND_TELA; // instancia de objetos da pagina logo = new Image { //Source = ImageSource.FromResource("VotacaoEstampas.Images.logo_white_512.png"), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HeightRequest = alturaLogo, WidthRequest = alturaLogo }; txtNome = new CustomEntry { Placeholder = "Nome:", FontSize = FONTE_TEXTO_LABELS, FontFamily = FAMILIA_TEXTO_LABELS, FontAttributes = ATRIBUTOS_TEXTO_LABELS, PlaceholderColor = COR_TEXTO_LABELS, TextColor = COR_TEXTO_LABELS, HeightRequest = FONTE_TEXTO_LABELS + 30, Keyboard = Keyboard.Text }; txtNome.Completed += (object sender, EventArgs e) => { txtEmail.Focus(); }; txtEmail = new CustomEntry { Placeholder = "Email:", FontSize = FONTE_TEXTO_LABELS, FontFamily = FAMILIA_TEXTO_LABELS, FontAttributes = ATRIBUTOS_TEXTO_LABELS, PlaceholderColor = COR_TEXTO_LABELS, TextColor = COR_TEXTO_LABELS, Keyboard = Keyboard.Email }; txtEmail.Completed += (object sender, EventArgs e) => { txtFone.Focus(); }; txtFone = new CustomEntry { Placeholder = "Fone:", FontSize = FONTE_TEXTO_LABELS, FontFamily = FAMILIA_TEXTO_LABELS, FontAttributes = ATRIBUTOS_TEXTO_LABELS, PlaceholderColor = COR_TEXTO_LABELS, TextColor = COR_TEXTO_LABELS, Keyboard = Keyboard.Numeric, }; txtFone.TextChanged += TxtFone_TextChanged; var btnIniciarPesquisa = new CustomButton { Text = "Iniciar Pesquisa", FontSize = FONTE_TEXTO_LABELS, FontFamily = FAMILIA_TEXTO_LABELS, FontAttributes = ATRIBUTOS_TEXTO_LABELS, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, TextColor = COR_TEXTO_LABELS, BorderRadius = 20, HeightRequest = FONTE_TEXTO_LABELS + 30, CorBackgroundCustomRed = 30, CorBackgroundCustomGreen = 30, CorBackgroundCustomBlue = 30 }; txtFone.Completed += (object sender, EventArgs e) => { btnIniciarPesquisa.Focus(); }; btnIniciarPesquisa.Clicked += VerificarUser; var containerBtn = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Padding = new Thickness(40, 0), Children = { btnIniciarPesquisa } }; // set conteudo da página Content = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Spacing = 20, Children = { logo, txtNome, txtEmail, txtFone, containerBtn } }; }
/// <summary> /// Initializes a new instance of the <see cref="AutoCompleteView"/> class. /// </summary> public AutoCompleteView() { _availableSuggestions = new ObservableCollection <object>(); _stkBase = new StackLayout(); var innerLayout = new StackLayout(); _entText = new CustomEntry() { HorizontalOptions = TextHorizontalOptions, VerticalOptions = TextVerticalOptions, TextColor = TextColor, BackgroundColor = TextBackgroundColor }; _btnSearch = new Button { VerticalOptions = SearchVerticalOptions, HorizontalOptions = SearchHorizontalOptions, Text = SearchText }; _lstSuggestions = new ListView { HeightRequest = SuggestionsHeightRequest, HasUnevenRows = true }; innerLayout.Children.Add(_entText); innerLayout.Children.Add(_btnSearch); _stkBase.Children.Add(innerLayout); _stkBase.Children.Add(_lstSuggestions); Content = _stkBase; _entText.TextChanged += (s, e) => { Text = e.NewTextValue; OnTextChanged(e); }; _btnSearch.Clicked += (s, e) => { if (SearchCommand != null && SearchCommand.CanExecute(Text)) { SearchCommand.Execute(Text); } }; _lstSuggestions.ItemTapped += (s, e) => { var index = _entText.Text.LastIndexOfAny(new[] { ',', ' ' }); if (index > 0) { _entText.Text = _entText.Text.Substring(0, index + 1) + e.Item.ToString(); } else { _entText.Text = e.Item.ToString(); } _availableSuggestions.Clear(); ShowHideListbox(false); OnSelectedItemChanged(e.Item); if (ExecuteOnSuggestionClick && SearchCommand != null && SearchCommand.CanExecute(Text)) { SearchCommand.Execute(e); } _entText.Focus(); }; ShowHideListbox(false); _lstSuggestions.ItemsSource = _availableSuggestions; }