Using events with contentView

Hi! So I'm pretty new to Xamarin and I'm not sure how to go about this, but I'll explain what I'm trying to accomplish. I'm trying to create a ContentView that handles camera options like taking a picture and retrieving a picture from the user's device. Ideally, this view would consist of a camera icon that when clicked presents the user with options as to how to retrieve a picture. Here is where my problem lies.

I cannot call the DisplayActionSheet method from the ContentView so I've tried using MessagingCenter. Using this approach, the ContentPage that holds the ContentView subscribes to the message broadcasted when the user clicks the camera icon. The options are sent as an array of strings and the DisplayActionSheet method is called. This isn't the best way to go about this, I have been told, and I'm now trying to do this with Events and BindableProperties. I'm struggling though.

How would I go about calling the DisplayActionSheet method upon the user tapping the icon and then return the answer back to the ContentView for further action?

Answers

Sign In or Register to comment.