Skip to content
Browse documentation

Sheet

A panel opened from code that slides in from a side over the dimmed window, as uikit:Sheet.

ExampleInteractive
Sheet — Avalonia UIKit
Live demo unavailable
<Border Width="560" Height="320" HorizontalAlignment="Left">
  <WrapPanel ItemSpacing="8" LineSpacing="8" Margin="16" HorizontalAlignment="Left" VerticalAlignment="Top">
    <Button Classes="outline" Content="Left" Tag="Left" Click="OnShowSheet" />
    <Button Classes="outline" Content="Right" Tag="Right" Click="OnShowSheet" />
    <Button Classes="outline" Content="Top" Tag="Top" Click="OnShowSheet" />
    <Button Classes="outline" Content="Bottom" Tag="Bottom" Click="OnShowSheet" />
    <Button Classes="outline" Content="Half the width" Click="OnShowHalf" />
  </WrapPanel>
</Border>

Usage

uikit:Sheet is the Sheet opened from code, over the whole window: new Sheet { Title = "Settings", Content = ... }.Show(this). It sits on the window's overlay layer, so popups opened from it stay above it, and one sheet is open per window: showing another closes the open one. Opening it moves the focus into it and keeps Tab inside; Escape, the close button and a press on the overlay close it, and the focus goes back to where it was. Closed is raised however it closes, and Sheet.GetActive(visual) returns the open one.

PropertyMeaning
PlacementThe side it slides in from: Left, Right (the default), Top or Bottom.
SizeIts width, or height from the top or bottom: pixels (350 by default) or a part of the window, such as 50%.
Title, Content, FooterThe title row, the body (it scrolls) and the footer.
HasOverlayWhether the window is dimmed; without it the overlay is clear but still takes the presses.
IsOverlayClosableWhether a press on the overlay closes the sheet.

The demo opens a sheet from each side, and one at half the window's width; the footer's buttons call Close.