我有一个基本的DataTemplate,我用来绑定暴露几个属性的基本对象.这些项目显示在ItemList.我试图确保绑定的TextBlock Icon显示类似于将存储在对象Icon属性中的符号.
<DataTemplate x:Key="Action180x180ItemTemplate">
<Grid HorizontalAlignment="Left" Width="180" Height="180">
<Border Background="OliveDrab">
<TextBlock Text="{Binding Icon}" FontFamily="Segoe UI Symbol" FontSize="72" Padding="0,20,0,0" TextAlignment="Center" />
</Border>
<StackPanel VerticalAlignment="Bottom" Background="DarkOliveGreen">
<TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="30" Margin="15,0,15,0"/>
</StackPanel>
</Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
问题是,当执行代码时,不显示符号,而是显示原始值.有没有人知道如何从绑定字段中显示符号(最好不要将Icon属性更改String为其他内容)?