void SetPlaceholderColor(WPicker view) { if (view.PlaceholderColor != Color.Default) { Control.SetHintTextColor(view.PlaceholderColor.ToAndroid()); } }
void SetHasBorder(WPicker view) { if (!view.HasBorder) { Control.SetBackgroundColor(Color.Transparent.ToAndroid()); Control.SetPadding(0, 0, 0, 0); } }
/// <summary> /// Sets the color of the placeholder text. /// </summary> /// <param name="view">The view.</param> void SetPlaceholderColor(WPicker view) { if (string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderColor != Color.Default) { NSAttributedString placeholderString = new NSAttributedString(view.Placeholder, new UIStringAttributes() { ForegroundColor = view.PlaceholderColor.ToUIColor() }); Control.AttributedPlaceholder = placeholderString; } }
/// <summary> /// Sets the text alignment. /// </summary> /// <param name="view">The view.</param> void SetHorizontalTextAlignment(WPicker view) { switch (view.HorizontalTextAlignment) { case TextAlignment.Center: Control.TextAlignment = UITextAlignment.Center; break; case TextAlignment.End: Control.TextAlignment = UITextAlignment.Right; break; case TextAlignment.Start: Control.TextAlignment = UITextAlignment.Left; break; } }
void SetHorizontalTextAlignment(WPicker view) { // I need to implement because I will override the vertical align. switch (view.HorizontalTextAlignment) { case Xamarin.Forms.TextAlignment.Start: Control.Gravity = GravityFlags.Left | GravityFlags.CenterVertical; break; case Xamarin.Forms.TextAlignment.Center: Control.Gravity = GravityFlags.Center | GravityFlags.CenterVertical; break; case Xamarin.Forms.TextAlignment.End: Control.Gravity = GravityFlags.Right | GravityFlags.CenterVertical; break; } }
/// <summary> /// Sets the border. /// </summary> /// <param name="view">The view.</param> void SetBorder(WPicker view) { Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None; }
/// <summary> /// Sets the placeholder. /// </summary> void SetPlaceholder(WPicker view) { Control.Placeholder = view.Placeholder; }
public RegisterWorkOutView() { SetTitlePage(); Label dateWorkoutLabel = new Label(); dateWorkoutLabel.Text = "WorkOut Date"; dateWorkoutLabel.TextColor = Color.White; DatePicker datePicker = new DatePicker(); datePicker.Date = DateTime.Now; datePicker.BackgroundColor = Color.Orange; datePicker.TextColor = Color.White; datePicker.Format = GlobalVariables.DateFormat; datePicker.SetBinding(DatePicker.DateProperty, "WorkOutDate"); WPicker <ISelectorItem> pickerLevel = new WPicker <ISelectorItem>(); pickerLevel.Title = "Workout Level"; pickerLevel.TextColor = Color.White; pickerLevel.BackgroundColor = Color.Orange; pickerLevel.SetBinding(WPicker <ISelectorItem> .ItemsObjectProperty, "Levels"); pickerLevel.SetBinding(WPicker <ISelectorItem> .SelectedObjectProperty, "SelectedLevel"); WPicker <ISelectorItem> pickerWorkout = new WPicker <ISelectorItem>(); pickerWorkout.Title = "Workout"; pickerWorkout.TextColor = Color.White; pickerWorkout.BackgroundColor = Color.Orange; pickerWorkout.SetBinding(WPicker <ISelectorItem> .ItemsObjectProperty, "WorkOuts"); pickerWorkout.SetBinding(WPicker <ISelectorItem> .SelectedObjectProperty, "SelectedWorkOut"); Editor editor = new Editor(); editor.Keyboard = Keyboard.Text; editor.Placeholder = "Observações"; editor.MinimumHeightRequest = 10; editor.TextColor = Color.Orange; editor.BackgroundColor = Color.White; editor.VerticalOptions = LayoutOptions.FillAndExpand; editor.SetBinding(Editor.TextProperty, "Observation"); Button buttonSave = new Button(); buttonSave.TextColor = Color.Black; buttonSave.Text = Lang.save; buttonSave.BackgroundColor = Color.White; buttonSave.BorderColor = Color.Orange; buttonSave.SetBinding(Button.CommandProperty, "SaveCommand"); StackLayout stack = new StackLayout(); stack.BackgroundColor = Color.Black; stack.Orientation = StackOrientation.Vertical; stack.VerticalOptions = LayoutOptions.FillAndExpand; stack.Padding = new Thickness(5, 3); stack.Children.Add(dateWorkoutLabel); stack.Children.Add(datePicker); stack.Children.Add(pickerLevel); stack.Children.Add(pickerWorkout); stack.Children.Add(editor); stack.Children.Add(buttonSave); Content = stack; }