ios.mp4
You can install the latest version of the package with this command
dotnet add package Simple.BottomSheet
You can also install it manualy in your IDE with the nuget package manager by searching Simple.BottomSheet.
Add UseBottomSheet() in your MAUI builder :
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseBottomSheet(); // Add UseBottomSheet
return builder.Build();
}
To use a bottom sheet you must proceed as follows:
- Create your page (Your page must inherit IBottomSheetRef) :
public partial class PurshaseBottomSheet : ContentView, IBottomSheetRef
{
public BottomSheet BottomSheetRef { get; set; }
public PurshaseBottomSheet()
{
InitializeComponent();
}
public void OnAppearing(object parameters){ }
}
- Register your page (and viewmodel if you use one) in your IOC container :
mauiAppBuilder.Services.AddTransient<PurshaseBottomSheet>(); // Pages must be registered as transient
- Inject IBottomSheetService into your page or viewmodel :
public MainPage(IBottomSheetService bottomSheetService)
{
InitializeComponent();
_bottomSheetService = bottomSheetService;
}
- Use it !
void Button_Clicked(System.Object sender, System.EventArgs e)
{
var bottomSheet = _bottomSheetService.ShowBottomSheet<PurshaseBottomSheet>();
}
Feel free to contribute to this project by proposing features and pull requests !