Код: Выделить всё
public static BottomSheetDialog ShowBottomSheet(this Page page, IView bottomSheetContent)
{
var bottomSheetDialog = new BottomSheetDialog(Platform.CurrentActivity?.Window?.DecorView.FindViewById(Android.Resource.Id.Content)?.Context ?? throw new InvalidOperationException("Context is null"));
bottomSheetDialog.SetContentView(bottomSheetContent.ToPlatform(page.Handler?.MauiContext ?? throw new Exception("MauiContext is null")));
bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.NotTouchable);
bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.DimBehind);
bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.NotFocusable);
bottomSheetDialog.Window?.AddFlags(WindowManagerFlags.SplitTouch);
bottomSheetDialog.Behavior.FitToContents = true;
bottomSheetDialog.Behavior.Draggable = true;
bottomSheetDialog.Behavior.SkipCollapsed = true;
bottomSheetDialog.SetCanceledOnTouchOutside(false);
bottomSheetDialog.Show();
return bottomSheetDialog;
}
Я пробовал настроить свойства поведения, такие как FitToContents, Draggable, SkipCollapsed и т. д., но мне не удалось сделать их немодальными.
Любая помощь или рекомендации о том, как изменить этот код для создания немодального нижнего листа, будем очень признательны.
Заранее спасибо!
Подробнее здесь: https://stackoverflow.com/questions/779 ... n-net-maui
Мобильная версия