小编ben*_*ton的帖子

Xamarin绑定默认值xaml

我默认IsVisible将对象的属性Xaml设置为false。但是,当我打开页面时,它是可见的,然后对绑定变量进行求值,如果是false,它将变为不可见。我希望它在默认情况下不可见,并且如果绑定变量为true,则它应该变为可见。我试图在我IsVisible的对象属性的绑定中插入默认值。我已经尝试FallbackValue = HiddenFallbackValue = Collapsed更多,甚至是TargetNullValue,但它不起作用。我总是得到一个XamlParseException

谁能帮我吗?谢谢。

代码(简体):

 <Grid HorizontalOptions="FillAndExpand"
       IsVisible="{Binding Path=Info.IsVisible, Converter={StaticResource BooleanToStringConverter}, FallbackValue=Collapsed}"
Run Code Online (Sandbox Code Playgroud)

xaml android xamarin xamarin.forms

5
推荐指数
1
解决办法
1845
查看次数

标签 统计

android ×1

xamarin ×1

xamarin.forms ×1

xaml ×1