【问题标题】:Xamarin Forms Change Frame Height in RuntimeXamarin 窗体在运行时更改帧高度
【发布时间】:2018-12-12 15:33:55
【问题描述】:

我想制作一个自定义下拉菜单,如下所示。

一旦用户点击了框架,我需要通过扩展框架高度来制作如下下拉菜单。

<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() 但没有成功。当用户单击框架时,如何更改代码后面的高度?

【问题讨论】:

标签: c# xaml xamarin xamarin.forms


【解决方案1】:
  1. 您可以为您的高度请求使用绑定并在视图模型中更改它。

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

  3. 另一件事,如果你不能改变高度,你可以使用可见的来隐藏它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-21
    相关资源
    最近更新 更多