在 Xaml/Windows Phone 上的图像中动态添加文本 [英] Dynamically add text in an image on Xaml/Windows Phone

查看:25
本文介绍了在 Xaml/Windows Phone 上的图像中动态添加文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 XAML 列表框,我在其中实现了一个图像,旁边有一个文本块.我想在该图像中显示计数文本.例如,对于图像中的第一个块,我想显示 1,对于第二个块,我想显示 2.如此继续.下面是片段.任何人都可以帮助我如何在图像中写入计数数字?

I have a XAML ListBox where I am implementing an Image beside that a block of text is there. I want to display a count text in that image. For example for the first block in the image I want to display 1, for the 2nd block I want to display 2. This goes on. Below is the snippet. Can anybody please help me how can I write the count numbers in the image?

 <StackPanel Grid.Column="0">
 <Image Source="/Assets/Images/pin.png"></Image>
  </StackPanel>
    <TextBlock Name="locationID" Visibility="Collapsed" ></TextBlock>
  </StackPanel>
 </StackPanel>

推荐答案

给你

<Grid Grid.Column="0">
    <Grid.Background>
        <ImageBrush ImageSource="/Assets/Images/pin.png"/>
    </Grid.Background>
    <TextBlock Text="text on image" Name="locationID" />
</Grid>

整个想法是将图像作为网格的背景,将文本作为网格的内容.

whole idea is to place the image as background of grid and place the text as content of the grid.

这篇关于在 Xaml/Windows Phone 上的图像中动态添加文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆