Please login to access all of the features of the Community Site.

ShareViewImage

Mobile20.0

Turns a view on the page into a PNG image and opens the share sheet so the person can send it to another app. Use it for content that is made to be passed along as a picture, such as a verse card or a sermon quote.

The CommandParameter must be a ShareViewImageParameters object with its View set. Without a view, the command does nothing.

Note

The image is taken from the view exactly as it's displayed, including text and images loaded from the server. The view must be on screen and finished loading when the command runs. If the image can't be created, the person sees a short message instead of the share sheet.

Properties

PropertyTypeDescription
ViewVisualElementThe view to capture, usually set with {x:Reference}. Everything inside the view is included in the image and nothing outside it is. Required.
TitlestringThe title of the share sheet. Optional.
FileNamestringThe name of the image file. Characters that aren't allowed in file names are removed, and .png is added if it's missing. Defaults to share.png.

Examples

<VerticalStackLayout>
    <Border x:Name="VerseCard"
        StyleClass="bg-interface-soft, p-16">
        <Label Text="Be still, and know that I am God."
            StyleClass="title2" />
    </Border>
    <Button Text="Share Verse"
        Command="{Binding ShareViewImage}">
        <Button.CommandParameter>
            <Rock:ShareViewImageParameters View="{x:Reference VerseCard}"
                Title="Share Verse"
                FileName="verse-of-the-day" />
        </Button.CommandParameter>
    </Button>
</VerticalStackLayout>