Modal Popup does not show camera

AndrewPriceAndrewPrice USMember
edited July 2016 in Xamarin.Forms

I have the following code in a xamarin forms project

   `public StackLayout AddImageControl()
    {
       StackLayout layout = new StackLayout();

        layout.BindingContext = new PictureViewModel(DependencyService.Get<ICameraProvider>());
        Button btnTakePicture = new Button()
        {
            Text = "Take a Picture",
            Command = (layout.BindingContext as PictureViewModel).TakePicture
        };

        Button btnSelectPicture = new Button()
        {
            Text = "SelectPicture",
            Command = ((PictureViewModel)layout.BindingContext).SelectPicture
        };

        Image img = new Image()
        {
            HeightRequest = 200,
            WidthRequest = 200
        };

        Binding selectPictureBinding = new Binding();

        selectPictureBinding.Path = "Picture";
        selectPictureBinding.Mode = BindingMode.TwoWay;

        img.SetBinding(Image.SourceProperty, selectPictureBinding);



        layout.Children.Add(img);
        layout.Children.Add(btnSelectPicture);
        layout.Children.Add(btnTakePicture);

        return layout;



    }

`
Then in the parent class I have

StackLayout FormOptions = new StackLayout(); FormOptions.Children.Add(FormQuestionControl.AddImageControl());
If I add this to a page it works, but if I add it to Modal Popup it doesnt. im using an iPhone. Anyone know why this would be the case ?

Thanks

Andrew

Sign In or Register to comment.