This is just one way of doing it by using MessagingCenter.
In your ContentView you can going to publish a message when you want the containing page to perform a DisplayActionSheet. In the ContentView you can also subscribe to the result of the DisplayActionSheet if desired by having the ContentPage publish the result of the user's selection and whatever has subscribed to that message id (your ContentView maybe) can then react to it.
ContentView-based code:
var gridButton = new Button { Text = "This button is in a Content View" };
gridButton.Clicked += delegate
{
var questions = new List<string> { "My ActionSheet Title", "Cancel", "Delete", "Share" };
MessagingCenter.Send<object, List<string>>(this, "PhotoMessageQuestion", questions);
};
MessagingCenter.Subscribe<object, string>(this, "PhotoMessageAnswer", (sender, arg) =>
{
System.Diagnostics.Debug.WriteLine("User choose: {0}", arg);
});
ContentPage-based code:
MessagingCenter.Subscribe<object, List<string>>(this, "PhotoMessageQuestion", async (sender, arg) =>
{
var photoAction = await DisplayActionSheet(arg[0], arg[1], arg[2], arg[3]);
MessagingCenter.Send<object, string>(this, "PhotoMessageAnswer", photoAction);
});
Results in:
