简单的下弹框控件使用方法:Syncfusion.Maui.Toolkit.BottomSheet

张中伟 60 信誉分
2025-02-03T11:21:58.9333333+00:00

我要在我的界面中实现点击或者选中某个项就从下面弹出操作框,框内有按钮点击就关闭了,不需要太复杂的操作。如何实现。

  xmlns:bottomSheet="clr-namespace:Syncfusion.Maui.Toolkit.BottomSheet;assembly=Syncfusion.Maui.Toolkit"

<bottomSheet:SfBottomSheet x:Name="sfbs1" >

            <bottomSheet:SfBottomSheet.Content>

                <VerticalStackLayout>

                    <Button x:Name="btnbsopen1" Text="弹出下提示框1" Clicked="btnbsopen1_Clicked"/>

--这个按钮放外面或者里面有什么区别。我都测试了没有弹出的效果。

                </VerticalStackLayout>

            </bottomSheet:SfBottomSheet.Content>

            <bottomSheet:SfBottomSheet.BottomSheetContent 

                >

                <Grid RowDefinitions="*,*,*">

                    <Label Grid.Row="0" Text="下弹出内容" TextColor="Red"/>

                    <Label Grid.Row="1" Text="{Binding imgname}" TextColor="Blue"/>

                    <Button Grid.Row="2" Text="关闭" WidthRequest="100"/>

                </Grid>

            </bottomSheet:SfBottomSheet.BottomSheetContent>

        </bottomSheet:SfBottomSheet>

--

    private void btnbsopen1_Clicked(object sender, EventArgs e)

    {

        this.sfbs1.BottomSheetContent.BindingContext = new clsImgInfo() { imgname = "testimgname1", imgurl = "http://abc.com/aa.jpg" };

        if (this.sfbs1.IsOpen)

        {

            this.sfbs1.State = BottomSheetState.HalfExpanded;

        }

        this.sfbs1.Show();

    }
.NET
.NET
基于 .NET 软件框架的 Microsoft 技术。
91 个问题
.NET MAUI
.NET MAUI
一种 Microsoft 开源框架,用于构建跨移动设备、平板电脑、台式机的原生设备应用程序。
130 个问题
C#
C#
一种面向对象的类型安全的编程语言,它起源于 C 语言系列,包括对面向组件的编程的支持。
201 个问题
0 个注释 无注释
{count} 票

你的答案

问题作者可以将答案标记为“接受的答案”,这有助于用户了解已解决作者问题的答案。