C# 绑定后能否将文本添加到文本块?

C# 绑定后能否将文本添加到文本块?,c#,uwp,C#,Uwp,所以我有一个Textblock,它使用(Text=“x”)绑定属性,但是有没有办法向其中添加更多文本 这是XAML中的行 <TextBlock Name="UpdatedStock" FontSize="12" Text="{x:Bind Stock, Mode=TwoWay}" HorizontalAlignment="Left" /> 它只写了自动取款机的数量,但我希望它写的是“库存X”。但

所以我有一个Textblock,它使用(Text=“x”)绑定属性,但是有没有办法向其中添加更多文本

这是XAML中的行

 <TextBlock Name="UpdatedStock" FontSize="12" Text="{x:Bind Stock, Mode=TwoWay}"  HorizontalAlignment="Left" />

它只写了自动取款机的数量,但我希望它写的是“库存X”。但是我不能给它添加更多的文本,有没有办法把它添加到同一行,或者我必须在其他地方添加

种类问候

绑定后能否将文本添加到文本块

你有很多方法可以接近。一般来说,我们通常会添加带有静态文本的新文本块X,并将其放在
UpdatedStock

<RelativePanel>
    <TextBlock
        x:Name="UpdatedStock"
        FontSize="12"
        RelativePanel.AlignLeftWithPanel="True"
        Text="{x:Bind Stock, Mode=OneWay}" />
    <TextBlock Margin="2,0,0,0"
        FontSize="12"
        RelativePanel.RightOf="UpdatedStock"
        Text="X" />
</RelativePanel>
用法

<Page.Resources>
    <local:StringConverter x:Key="StrConverter" />
</Page.Resources>
<Grid>

    <TextBlock
        x:Name="UpdatedStock"
        FontSize="12"
        RelativePanel.AlignLeftWithPanel="True"
        Text="{x:Bind Stock, Mode=OneWay, Converter={StaticResource StrConverter}}" />

</Grid>

<Page.Resources>
    <local:StringConverter x:Key="StrConverter" />
</Page.Resources>
<Grid>

    <TextBlock
        x:Name="UpdatedStock"
        FontSize="12"
        RelativePanel.AlignLeftWithPanel="True"
        Text="{x:Bind Stock, Mode=OneWay, Converter={StaticResource StrConverter}}" />

</Grid>