在 Avalonia 的 axaml 中定义 string 字符串
在 Avalonia 的 axaml 中定义 string 字符串
一、效果

二、代码
<Window.Resources>
<x:String x:Key="test_key">字符串字符串字符串字符串字符串</x:String>
</Window.Resources>
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{StaticResource test_key}" />
</Grid>
三、总结
类型需要使用 x:String,注意不是小写开头的 x:string,也不是没有 x 开头的 string和 String。

浙公网安备 33010602011771号