百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

Maui.BottomSheet

> 编程语言
开源

.Net Maui 中的原生底层页!

180 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

.Net Maui 中的原生底层页!

Plugin.Maui.BottomSheet

** Show native BottomSheets with .NET MAUI!**

✨ Features

  • Built-in NavigationService - Seamless navigation between bottom sheets
  • Flexible Content - Open any ContentPage or View as BottomSheet
  • Customizable Layout - Create BottomSheets in any layout
  • Configurable Header - Full header customization support
  • ️ MVVM Support - Complete MVVM pattern integration
  • Native Performance - Platform-specific implementations for optimal UX

Quick Demo

Check out the sample project to see the API in action!

Platform Support

Mobile

Apple iOS 15+

iPhone

iPad

Android API 21+

Phone

Tablet

Desktop

MacCatalyst 15+

Windows

Quick Start

1️⃣ Installation

Install the NuGet package:

bash
dotnet add package Plugin.Maui.BottomSheet

2️⃣ Setup

Enable the plugin in your MauiProgram.cs:

csharp
using Plugin.Maui.BottomSheet.Hosting;

var builder = MauiApp.CreateBuilder();
builder
    .UseMauiApp()
    .UseBottomSheet() //  Add this line
    .ConfigureFonts(fonts =>
    {
        fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
        fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
    });

#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();

3️⃣ Basic Usage

Add the XAML namespace:

xmlns:bottomsheet="http://pluginmauibottomsheet.com"

Create a simple bottom sheet:

xaml

    
        
    

Set peek height to view height (peek height changes dynamically as view height changes)

xaml

    
        
            
                
            
        
    

or

xaml

    
        
            
                
                    
                
            
        
    

[!CAUTION] The peek height is calculated using MAUI's measurement behavior. Different platforms may return different heights for the same layout. You should not set a ScrollView as your peek view reference. Use the root of your ScrollView instead. This is especially true when using VerticalStackLayout and Grid with Star rows. To observe the differences, launch the Plugin.BottomSheet.Tests.Maui.Ui.Application test project and open the various peek BottomSheets

API Reference

Core Properties

Property Type Description
IsModal bool Enable/disable interaction with content under BottomSheet
IsCancelable bool Allow user to close via gestures or background click
HasHandle bool Show/hide the drag handle
ShowHeader bool Show/hide the header section
IsOpen bool Control open/close state
IsDraggable bool Enable/disable drag gestures (useful for drawing)
States List Allowed states (Peek, Medium, Large)
CurrentState BottomSheetState Current display state
PeekHeight double Height when in peek state (iOS 16+)
Padding double Internal padding
BackgroundColor Color Background color
CornerRadius float Top corner radius
WindowBackgroundColor Color Window background (modal only)
SizeMode BottomSheetSizeMode Represents a size mode for the bottom sheet where the height is adjusted dynamically to fit the content displayed within it or a fixed value based on the number of states it can display.

Size Modes

State Description
States Represents a size mode for the bottom sheet where the height is set to a fixed value based on the number of states it can display. This mode ensures the bottom sheet is fully expanded rather than dynamically adjusting its size to-fit content.
FitToContent A size mode indicating that the bottom sheet dynamically adjusts its height to precisely fit the content it displays. In this mode, the bottom sheet wraps around its contents and does not occupy any more vertical space than necessary.

[!CAUTION] Mode FitToContent is not compatible with the States and CurrentState property. Do not mix these two properties. Requires iOS 16+. On prior versions of iOS, the medium state will be used instead.

[!NOTE] On iOS and MacCatalyst, custom-detent presentations such as FitToContent and peek-only sheets internally include a large detent sentinel so UIKit can keep non-modal sheets undimmed. If the user drags to that sentinel, the sheet automatically snaps back to the custom detent.

BottomSheet States

State Description
Peek Fractional height (customizable)
Medium Half screen height
Large Full screen height

Header Configuration

Property Type Description
TitleText string Title text displayed in header
TopLeftButton Button Custom button for top-left position
TopRightButton Button Custom button for top-right position
HeaderDataTemplate DataTemplate Custom view template (overrides other header properties)
Content View Direct view content
HeaderAppearance BottomSheetHeaderButtonAppearanceMode Controls which buttons are displayed
ShowCloseButton bool Show built-in close button
CloseButtonPosition CloseButtonPosition Position of close button (Left/Right)

[!CAUTION] Be careful when using Content because the Content will be created even if the BottomSheet isn't open and this may have a negative performance impact. Content should only be used with navigation and not in BottomSheets added directly to a Layout.

Content Configuration

Property Type Description
Content View Direct view content
ContentTemplate DataTemplate Template for lazy loading

[!CAUTION] Be careful when using Content because the Content will be created even if the BottomSheet isn't open and this may have a negative performance impact. Content should only be used with navigation and not in BottomSheets added directly to a Layout.

Styling Options

BottomSheet Style Properties

Property Type Description
HeaderStyle BottomSheetHeaderStyle Styling configuration for header elements

BottomSheet Header Style Properties

Property Type Description
TitleTextColor Color Color of the title text
TitleTextFontSize double Font size of the title text
TitleTextFontAttributes FontAttributes Font attributes (Bold, Italic, None)
TitleTextFontFamily string Font family name for title text
TitleTextFontAutoScalingEnabled bool Enable automatic font scaling
CloseButtonHeightRequest double Requested height for close button
CloseButtonWidthRequest double Requested width for close button
CloseButtonTintColor Color Tint color for close button icon

Advanced Examples

Complete XAML Example

xaml

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言