如何在地图图钉内容中添加换行符?
我刚刚开始在 Windows Phone 应用程序中使用地图,但我不知道如何在图钉内容中添加换行符。这是我的代码:
<my:Map Height="756" HorizontalAlignment="Left" Name="map1" VerticalAlignment="Top" Width="468" CredentialsProvider="Auc_zPo5mypWlRwCBm73jnZE0D-6AqBQq6bSdt8XpRA" Center="41.6154423246811, 0.738656005859375" ZoomBarVisibility="Visible" ZoomLevel="12" >
<my:Pushpin Location="41.6154423246811, 0.738656005859375" Content="First line, \n second line" />
</my:Map>
谢谢您的帮助
I've just started using maps in my Windows Phone application and I can't figure out how can I have linebreaks in the pushpin's content. Here's my code:
<my:Map Height="756" HorizontalAlignment="Left" Name="map1" VerticalAlignment="Top" Width="468" CredentialsProvider="Auc_zPo5mypWlRwCBm73jnZE0D-6AqBQq6bSdt8XpRA" Center="41.6154423246811, 0.738656005859375" ZoomBarVisibility="Visible" ZoomLevel="12" >
<my:Pushpin Location="41.6154423246811, 0.738656005859375" Content="First line, \n second line" />
</my:Map>
Thank you for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为图钉的内容提供一个模板:
请注意,图钉(即 ContentControl)的默认属性是它的“内容”,因此您可以通过在标签之间添加代码来直接编辑其内容。
以下是有关自定义图钉的良好信息来源:
http://msdn.microsoft.com/en-我们/gg266447
You can provide a template for the content of your pushpin:
Note that default property of Pushpin (i.e. a ContentControl) is it's "Content" so you can directly edit it's content by adding codes between tags.
Here is a good source of information about customizing pushpins:
http://msdn.microsoft.com/en-us/gg266447
使用
System.Environment.NewLine
例如
Mypushpin.Content = "这是第一行 "+ System.Environment.NewLine + "这是第二行!";
Use
System.Environment.NewLine
eg
Mypushpin.Content = "This is line one "+ System.Environment.NewLine + "and this is line two!";