从函数中评估 xBind

在 v1607(Redstone 1)之后,此功能被添加到 Bind 标记扩展中。
你可以指定函数路径,以及 arg 路径和常量 args。假设我们在我们的反码中定义了一个函数:

public string Translate(string text, string from, string to)

现在我们可以使用 bind 来将函数计算到我们想要的元素中:

<TextBlock Name="SomeText" Text="How are you?" />
<TextBlock Name="{x:Bind Translate(SomeText.Text, 'en', 'es')}" />

函数和 arg 路径也可以包含点和强制转换。