public BorderedEntry() { this.Entry = new Entry() { TextColor = Color.Black, PlaceholderColor = Color.Black, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; this.Entry.Focused += (o, e) => { this.BackgroundColor = ValueInvalid ? this.InvalidBorderColor : this.FocusedBorderColor; HandleFocused(o, e); }; this.Entry.Unfocused += (o, e) => { this.BackgroundColor = ValueInvalid ? this.InvalidBorderColor : this.BorderColor; Unfocused?.Invoke(o, e); }; this.Entry.TextChanged += HandleTextChanged; this.Entry.Completed += HandleCompleted; this.Padding = new Thickness(1); this.Content = this.Entry; constructorCodeExecutionFinished = true; }
public void Unfocus() { if (!IsFocused) { return; } IsFocused = false; Unfocused?.Invoke(this); }
/// <summary> /// The callback of the Realized event. /// </summary> /// <since_tizen> preview </since_tizen> protected override void OnRealized() { base.OnRealized(); _focused = new SmartEvent(this, "focused"); _focused.On += (s, e) => Focused?.Invoke(this, EventArgs.Empty); _unfocused = new SmartEvent(this, "unfocused"); _unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty); }
internal void FireFocused(bool focused) { if (focused) { Focused.Fire(); } else { Unfocused.Fire(); } }
private void HandleFocusChange(object sender, FocusEventArgs e) { base.SetFocusChange(lblLabel, frmContainer, bxvLine); if (IsControlFocused) { Focused?.Invoke(this, e); } else { Unfocused?.Invoke(this, e); } }
private void HandleFocusChange(object sender, FocusEventArgs e) { SetLabelTextColor(lblLabel); SetTextColor(); SetTypeBackgroundAndBorderColor(); if (IsControlFocused) { Focused?.Invoke(this, e); } else { Unfocused?.Invoke(this, e); } }
private void HandleFocusChange(object sender, FocusEventArgs e) { base.SetFocusChange(lblLabel, frmContainer, bxvLine); if (IsControlFocused) { Focused?.Invoke(this, e); var textInsideInput = txtEntry.Text; txtEntry.CursorPosition = string.IsNullOrEmpty(textInsideInput) ? 0 : textInsideInput.Length; } else { Unfocused?.Invoke(this, e); } }
private void HandleFocusChange(object sender, FocusEventArgs e) { base.SetFocusChange(lblLabel, frmContainer, bxvLine); // Set the default date if the user doesn't select anything if (!IsControlFocused && !pckDate.Date.HasValue) { Date = pckDate.InternalDateTime; } if (IsControlFocused) { Focused?.Invoke(this, e); } else { Unfocused?.Invoke(this, e); } }
/// <summary> /// Default Constructor /// </summary> public AdvancedEntry() { txtInput = GetInputEntry(); this.Children.Add(lblTitle); this.Children.Add(frmBackground); ApplyValidationPosition(GlobalSetting.LabelPosition); frmBackground.Content = new Grid { BackgroundColor = Color.Transparent, Children = { new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Transparent, Children = { imgIcon, txtInput } }, imgWarning } }; txtInput.TextChanged += TxtInput_TextChanged; txtInput.Completed += (s, args) => { ExecuteCommand(); Completed?.Invoke(this, new EventArgs()); FocusNext(); }; txtInput.Focused += (s, args) => { var arg = new FocusEventArgs(this, true); FocusedCommand?.Execute(arg); Focused?.Invoke(this, arg); }; txtInput.Unfocused += (s, args) => { var arg = new FocusEventArgs(this, false); UnfocusedCommand?.Execute(arg); Unfocused?.Invoke(this, arg); }; imgWarning.IsVisible = this.IsRequired; Reset(); }
protected virtual void onUnfocused(object sender, EventArgs e){ #if DEBUG_FOCUS Debug.WriteLine("UnFocused => " + this.ToString()); #endif Unfocused.Raise (this, e); }
private void entry_Unfocused(object sender, FocusEventArgs e) { entryBorder.BorderColor = BorderColor; Unfocused?.Invoke(entry, e); }
private void DatePicker_Unfocused(object sender, FocusEventArgs e) { FocusCommand?.Execute(datePicker.IsFocused); Unfocused?.Invoke(this, e); }