private void SetTextAlignment(ExtendedEntry view) { if (view.IsPassword && _thisPasswordBox != null) { switch (view.XAlign) { //NotCurrentlySupported: Text alaignement not available on Windows Phone for Password Entry } } else if (!view.IsPassword && _thisPhoneTextBox != null) { switch (view.XAlign) { case TextAlignment.Center: _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Center; break; case TextAlignment.End: _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Right; break; case TextAlignment.Start: _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Left; break; } } }
private void SetFont(ExtendedEntry view) { UIFont uiFont; if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null) Control.Font = uiFont; else if (view.Font == Font.Default) Control.Font = UIFont.SystemFontOfSize(17f); }
private void SetBorder(ExtendedEntry view) { if (view.IsPassword && _thisPasswordBox != null) { _thisPasswordBox.BorderThickness = view.HasBorder ? new System.Windows.Thickness(2) : new System.Windows.Thickness(0); } else if (!view.IsPassword && _thisPhoneTextBox != null) { _thisPhoneTextBox.BorderThickness = view.HasBorder ? new System.Windows.Thickness(2) : new System.Windows.Thickness(0); } }
private void SetTextAlignment(ExtendedEntry view) { switch (view.XAlign) { case Xamarin.Forms.TextAlignment.Center: Control.Gravity = GravityFlags.CenterHorizontal; break; case Xamarin.Forms.TextAlignment.End: Control.Gravity = GravityFlags.End; break; case Xamarin.Forms.TextAlignment.Start: Control.Gravity = GravityFlags.Start; break; } }
private void SetTextAlignment(ExtendedEntry view) { switch (view.XAlign) { case TextAlignment.Center: Control.TextAlignment = UITextAlignment.Center; break; case TextAlignment.End: Control.TextAlignment = UITextAlignment.Right; break; case TextAlignment.Start: Control.TextAlignment = UITextAlignment.Left; break; } }
/// <summary> /// Creates a new instance of the <see cref="ExtendedEntryPage"/> class /// </summary> public ExtendedEntryPage() { InitializeComponent(); var entryFromCode = new ExtendedEntry() { Placeholder = "Aded from code, custom font", Font = Font.OfSize("Open 24 Display St", NamedSize.Medium) }; stackLayout.Children.Add(entryFromCode); var swipeEntry = new ExtendedEntry() { Placeholder = "Swipe me..." }; swipeEntry.LeftSwipe += (s, e) => swipeEntry.Text = "Swiped left"; swipeEntry.RightSwipe += (s, e) => swipeEntry.Text = "Swiped right"; stackLayout.Children.Add(swipeEntry); }
private void SetPlaceholderTextColor(ExtendedEntry view){ if(view.PlaceholderTextColor != Color.Default) Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid()); }
private void SetFont(ExtendedEntry view) { if (view.Font != Font.Default) Control.TextSize = view.Font.ToScaledPixel(); }
private void SetBorder(ExtendedEntry view) { //NotCurrentlySupported: HasBorder peroperty not suported on Android }
private void SetFont(ExtendedEntry view) { if (view.Font != Font.Default) if (view.IsPassword) { if (_thisPasswordBox != null) { _thisPasswordBox.FontSize = view.Font.GetHeight(); } } else { if (_thisPhoneTextBox != null) { _thisPhoneTextBox.FontSize = view.Font.GetHeight(); } } }
private void SetPlaceholderTextColor(ExtendedEntry view) { //the EntryRenderer renders two child controls. A PhoneTextBox or PasswordBox // depending on the IsPassword property of the Xamarin form control if (view.IsPassword) { //NotCurrentlySupported: Placeholder text color is not supported on Windows Phone Password control } else { if (view.PlaceholderTextColor != Color.Default && _thisPhoneTextBox != null) { var hintStyle = new Style(typeof(ContentControl)); hintStyle.Setters.Add( new Setter( System.Windows.Controls.Control.ForegroundProperty, view.PlaceholderTextColor.ToBrush()) ); _thisPhoneTextBox.HintStyle = hintStyle; } } }
private void SetPlaceholderTextColor(ExtendedEntry e, EditText editText){ if(e.PlaceholderTextColor != Color.Default) { editText.SetHintTextColor(e.PlaceholderTextColor.ToAndroid()); //editText.SetHintTextColor(e.PlaceholderTextColor.ToAndroid); } }
private void SetBorder(ExtendedEntry view) { Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None; }
void SetPlaceholderTextColor(ExtendedEntry view) { /* UIColor *color = [UIColor lightTextColor]; YOURTEXTFIELD.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"PlaceHolder Text" attributes:@{NSForegroundColorAttributeName: color}]; */ if(string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderTextColor != Color.Default) { NSAttributedString placeholderString = new NSAttributedString(view.Placeholder, new UIStringAttributes(){ ForegroundColor = view.PlaceholderTextColor.ToUIColor() }); Control.AttributedPlaceholder = placeholderString; } }