Dumindu De Silva
Dumindu De Silva

Reputation: 173

Xamarin Forms Change Frame Height in Runtime

I want to make a custom dropdown as below.

enter image description here

once user clicked on the frame I need to make a dropdown as below by expanding frame height.

enter image description here

<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>

I tried using heightRequest, forceLayout() but no luck. How can I change the height from code behind when the user click on the frame?

Upvotes: 1

Views: 2107

Answers (1)

mohammad kamali
mohammad kamali

Reputation: 409

  1. you can use binding for your height request and change it in the view model.

  2. also you can use syncfusion combo box to reach that purpose.

  3. another thing if you couldnt change height you can use visible to invisible it

Upvotes: 1

Related Questions