[英]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. 我有布局,我尝试在向下箭头按钮单击时隐藏并显示2个按钮,该按钮在可扩展列表中,这在2个按钮中造成波动。
Tried reducing height of those 2 buttons initially and then give some height dynamically. 尝试先减小这2个按钮的高度,然后动态给出一些高度。
<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. 要在Xamarin Forms中隐藏和显示View,请使用
IsVisible
属性,该属性接受布尔值,默认情况下设置为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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.