包含 `{` 的字符串需要转义。字符串以 `{}` 开头”

Strings containing `{` needs to be escaped. Start the string with `{}`"

在我的 Xamarin 项目中,我有一个格式化日期值的标签。我更新了一些 Xamarin Nuget 包,现在我收到以下错误:

Strings containing { needs to be escaped. Start the string with {}"

页面上的标签很简单StringFormat

<Label Text="{Binding Booking.ScheduledDeparture, StringFormat='{0:dd/MM/yyyy}'}"/>

关于如何解决此错误的任何想法。我试过将 @ 添加到 StringFormat 的开头,但这没有用。

在以 { 开头的字符串前添加 {} 这应该将其转义。所以'{}{0:dd/MM/yyyy}'。 如需更多文档:https://docs.microsoft.com/en-us/dotnet/framework/xaml-services/escape-sequence-markup-extension