Cover Sheet

The ins and outs of displaying and styling cover sheets

Cover sheets are a commonly patterned way to present information to a user that doesn't rely on changing the navigation stack.

Cover sheets cannot be opened within cover sheets. Some blocks utilize cover sheets to reveal content or forms, so be sure not to include these blocks in the navigation stack.

Android

Currently, there is not a ton of Android functionality. It works similarly to a PushPage but has an animation that slides from bottom to top instead of from right to left.

Parameters

Listed below are the options provided via the ShowCoverSheetCommandParameters object.

PropertyTypeDescription

PageGuid

Guid

The Guid of the page you wish to display in the cover sheet, use this instead of Content.

Content

View

The content you wish to display inside of the cover sheet, use this instead of PageGuid.

ModalPresentationStyle

ModalPresentationStyle

[iOS ONLY] The way that the sheet is presented on iOS. There are currently four accepted values: FormSheet, PageSheet, FullScreen and OverFullScreen. Defaults to FormSheet.

IsNavigationPage

bool

Whether or not the page displayed should be converted into a page that has a toolbar with a dismiss button. Defaults to true.

SheetTitle

string

The title of the sheet, displays in the middle of the navigation bar.

DismissButtonText

string

The text to use in the dismiss button, seen in the toolbar (navigation bar) of the sheet. Defaults to Cancel.

bool

Whether or not this instance should show a navigation bar. IsNavigationPage must be enabled. (defaults to false)

Button

The button to use as the primary action, seen in the top right corner of cover sheets.

Button

The button to use as the secondary action, seen in the top left corner of cover sheets.

You can style the Navigation Bar itself by targeting the cover-sheet class. For example, if you want to change the background bar color, text color, and remove the FullScreen separator:

.cover-sheet {
    -xf-bar-background-color: green;
    -xf-bar-text-color: #ffffff;
    -rock-status-bar-text: light;
    -rock-ios-hide-navigation-bar-separator: true;
}

Examples

To show a cover sheet that displays another page, pass in the PageGuid as the CommandParameter.

<!-- Cover sheet used to display another page as content. -->
<Button Text="Tap"
    StyleClass="btn, btn-primary"
    Command="{Binding ShowCoverSheet}"
    CommandParameter="71e80253-8d10-426b-8182-65dafe9b695f" />

To show a cover sheet from provided XAML content, pass in the XAML content you want to render inside of the CommandParameter.

<!-- Cover sheet with content as the parameter. -->
<Button Text="Tap"
    StyleClass="btn, btn-primary"
    Command="{Binding ShowCoverSheet}">
    <Button.CommandParameter>
        <StackLayout>
            <Label Text="This is cover sheet content."
                StyleClass="h1" />
        </StackLayout>
    </Button.CommandParameter>
</Button>

Here is an extensive example with most of the ShowCoverSheetParameters properties utilized.

<Button Text="Tap"
    StyleClass="btn, btn-primary"
    Command="{Binding ShowCoverSheet}">
    <Button.CommandParameter>
        <Rock:ShowCoverSheetParameters SheetTitle="Title" 
            ModalPresentationStyle="FullScreen">
            <Rock:ShowCoverSheetParameters.Content>
                <StackLayout>
                    <Label Text="This is cover sheet content."
                        StyleClass="h3" />
                </StackLayout>
            </Rock:ShowCoverSheetParameters.Content>
            <Rock:ShowCoverSheetParameters.PrimaryActionButton>
                <Button Command="{Binding ShowToast}" 
                    Text="Toast"
                    CommandParameter="That was a unique use of the PrimaryActionButton..." />
            </Rock:ShowCoverSheetParameters.PrimaryActionButton>
            <Rock:ShowCoverSheetParameters.SecondaryActionButton>
                <Button Command="{Binding CloseCoverSheet}" 
                    Text="Dismiss" />
            </Rock:ShowCoverSheetParameters.SecondaryActionButton>
        </Rock:ShowCoverSheetParameters>
    </Button.CommandParameter>
</Button>

Closing a Cover Sheet

<Button Text="Tap"
    Command="{Binding CloseCoverSheet}" />

Last updated

⚙️ Powered by Rock RMS