Skip to content

Sheet FAQ

Håvard Moås edited this page Aug 13, 2020 · 8 revisions

Sheet and navigationbar

The sheet component will not have anything built in to disable the back buttons in the navigation bar. It will also not have anything built in to handle the android back button.

The reason for this is because we have discussed that this might wary in different cases of an app. This should be handled by the consumers of the sheet.

Disable navigation back button:

When something changed

public void OnSomethingChangedEvent(..)
{
    if(Sheet.IsOpen)
    {
        NavigationBar.HasBackButton = false;
    }
    else
    {
        NavigationBar.HasBackButton = true;
    }
    
}

Bind it in your ContentPage

<ContentPage
    ...
    NavigationPage.HasBackButton="{Binding ViewModelProperty}"
    >
<ContentPage
    ...
    NavigationPage.HasBackButton="{Binding Source{x:reference Sheet}, Path=IsOpen}"
    >
        ...
        <dxui:SheetBehavior x:Name="Sheet" ... >
        ...

Remove navigation bar

When something changed

public void OnSomethingChangedEvent(..)
{
    if(Sheet.IsOpen)
    {
        NavigationBar.HasNavigationBar = false;
    }
    else
    {
        NavigationBar.HasNavigationBar = true;
    }
    
}

Bind it in your ContentPage

<ContentPage
    ...
    NavigationPage.HasNavigationBar="{Binding ViewModelProperty}"
    >

Or bind it to the sheet behavior

<ContentPage
    ...
    NavigationPage.HasNavigationBar="{Binding Source{x:reference Sheet}, Path=IsOpen}"
    >
        ...
        <dxui:SheetBehavior x:Name="Sheet" ... >
        ...