繁体   English   中英

Xamarin表单在运行时更改框架高度

[英]Xamarin Forms Change Frame Height in Runtime

我要制作一个自定义下拉列表,如下所示。

在此处输入图片说明

用户单击框架后,我需要通过扩大框架高度来进行如下下拉。

在此处输入图片说明

<Frame CornerRadius="8" BackgroundColor="{StaticResource LightAirColor}" Padding="10,4,10,4">
    <TableView>
        <TableSection>
            <ViewCell Tapped="OnSortingPaneTapped">
                <StackLayout Orientation="Vertical">
                    <StackLayout Orientation="Horizontal">
                        <Label Text="Arrange By" TextColor="{StaticResource DarkColor}" FontSize="{DynamicResource FontSize16}"/>
                        <Label Text="Date/Time" TextColor="{StaticResource NavigationPrimary}" FontSize="{DynamicResource FontSize16}"/>
                    </StackLayout>
                </StackLayout>
            </ViewCell>
            <ViewCell>
                <StackLayout Orientation="Horizontal">
                    <Label Text="Episode" TextColor="{StaticResource NavigationPrimary}" FontSize="{DynamicResource FontSize16}"/>
                </StackLayout>
            </ViewCell>
            <ViewCell Tapped = "SortJournalByDate">
                <StackLayout Orientation="Horizontal" VerticalOptions="Center">
                    <Label Text="Date/Time" TextColor="{StaticResource NavigationPrimary}" FontSize="{DynamicResource FontSize16}"/>
                </StackLayout>
            </ViewCell>
        </TableSection>
    </TableView>
</Frame>

我尝试使用heightRequest,forceLayout(),但没有运气。 当用户单击框架时,如何从代码后面更改高度?

  1. 您可以将绑定用于您的身高要求,并在视图模型中进行更改。

  2. 您也可以使用syncfusion组合框达到此目的。

  3. 另一件事,如果您无法更改高度,则可以使用可见到不可见的高度

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM