1

我可以在 xaml 中使用逻辑吗?

IsVisible="{Binding OnlyTraverseSelectedSection != null ? true : false}"

某种程度上来说?

4

1 回答 1

2

您目前不能在绑定中使用表达式 - 我希望是这样,但我们还没有!

话虽如此,您可以在绑定中使用一种表达式 - 否定运算符:

https://github.com/AvaloniaUI/Avalonia/blob/master/docs/spec/binding-from-xaml.md#negating-bindings

一个例子:

<TextBox IsEnabled="{Binding !HasErrors}"/>

于 2017-09-24T03:16:06.943 回答