简体   繁体   中英

How to avoid Fluctuation in show and hide UI controls in Xamarin forms iOS?

I have layout where i am trying to hide and show 2 buttons on click of down arrow button which is in expandable list which is creating fluctuation in 2 buttons.

Tried reducing height of those 2 buttons initially and then give some height dynamically.

<Button x:Name="completebtn" IsVisible="{Binding TaskStatus}"
                                   AutomationId="btnComplete"
                                   Command="{Binding BindingContext.CompleteOptionClickedCommand,
                                    Source={x:Reference taskList}}" CommandParameter="{Binding .}"
                                   Style="{StaticResource darkBlueButton}"
                                   Text="Complete"
                                   HeightRequest="50"  
                                   WidthRequest="120"></Button>

Actual behavior is when i expand and collapse any list item the two buttons within the list item should not fluctuate until and unless i click on down arrow button.

To hide and show a View in Xamarin Forms you use the IsVisible property which accepts a boolean and is by default set to true.

You can use it like this:

<Button x:Name="MyButton"...... IsVisible="false"/>

Then In your code, you can set it back to visible, as follows:

MyButton.IsVisible=true;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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