StackLayout Picker_Row_Layout(ProductProperty Bind_Context) { var stack = new StackLayout { BackgroundColor = Color.White, Orientation = StackOrientation.Horizontal, HeightRequest = 60, Margin = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(20, 0, 20, 0) }; if (Bind_Context == null) { return(stack); } var label = new Label { FontFamily = "SanFranciscoDisplay-Regular", HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, TextColor = (Color)App.Current.Resources["GreyishBrown"] }; label.SetBinding(Label.TextProperty, Settings.DeviceLanguage == "en" ? "PropertyName" : "PropertyName_FR", BindingMode.OneWay); label.BindingContext = Bind_Context; var picker = new BorderlessPicker() { IsEnabled = controlEnabled, TextAlignMent = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Title = "Choose", TextColor = (Color)App.Current.Resources["turquoiseBlue"] }; picker.SetBinding(Picker.ItemsSourceProperty, "ItemSource", BindingMode.TwoWay); picker.SetBinding(Picker.SelectedItemProperty, "PropertyValue", BindingMode.TwoWay); picker.BindingContext = Bind_Context; stack.Children.Add(label); stack.Children.Add(picker); return(stack); }
void UpdatePickerPlaceholder() { if (picker == null) { picker = Element as BorderlessPicker; } if (picker.Placeholder != null) { Control.Hint = picker.Placeholder; } }
protected override void OnElementChanged(ElementChangedEventArgs <Picker> e) { base.OnElementChanged(e); if (e.NewElement != null) { picker = Element as BorderlessPicker; UpdatePickerPlaceholder(); if (picker.SelectedIndex <= -1) { UpdatePickerPlaceholder(); } } }