Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am currently learning xamarin.forms. I developed simple application for additon of Employee in SQLite

In this app there is picker control(like dropdown in .Net :)). When i select Other option in this picker i want to show/ hide entry control (like textbox in .net :))

In .net we show hide controls using panel..similarly which control i can use in xamarin

Please note i already hiding and showing entry control by using IsVisible property..but while hiding it still occupies space on app page

What I have tried:

My Xaml code

<Picker x:Name="Pkr_Department" Grid.Row="13" ></Picker>

<Entry x:Name="txtDepartment" Placeholder="Enter Department" Grid.Row="14" IsVisible="False" ></Entry>

My xaml.cs code
C#
Pkr_Department.SelectedIndexChanged += (sender, args) =>
            {
                if (Pkr_Department.SelectedIndex == 0)
                {
                    txtDepartment.IsVisible = true;

                   
                }
                else
                {
                    txtDepartment.IsVisible = false;
                }
            };
Posted
Updated 15-Feb-17 23:31pm
Comments
asdf CH 18-Sep-19 4:54am    
you can use also triggers to do this stuff.

1 solution

You need to put
Grid.Row="14"
height Auto

<RowDefinition Height="Auto" />


So based on IsVisible=True or False height will be auto adjust and on Isvisible=False it will not take space on page.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900