public SimpleColorPickerPageCS()
        {
            var picker = new Picker {
                Title = "Select a color"
            };

            picker.SetBinding(Picker.ItemsSourceProperty, "ColorNames");
            picker.SetBinding(Picker.SelectedItemProperty, "SelectedColorName", mode: BindingMode.TwoWay);

            var boxView = new BoxView {
                HeightRequest = 200
            };

            boxView.SetBinding(BoxView.ColorProperty, "SelectedColor");

            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    new Label {
                        Text = "Bindable Picker Demo", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center
                    },
                    picker,
                    boxView
                }
            };

            BindingContext = new SimpleColorPickerPageViewModel();
        }
Exemple #2
0
 public SimpleColorPickerPage()
 {
     InitializeComponent();
     BindingContext = new SimpleColorPickerPageViewModel();
 }