1

我刚刚开始在我的 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>

谢谢您的帮助

4

2 回答 2

2

您可以为图钉的内容提供模板:

<my:Pushpin>
    <StackPanel>
        .. your content here
    </StackPanel/>
</my:Pushpin>

请注意,Pushpin(即 ContentControl)的默认属性是它的“内容”,因此您可以通过在标签之间添加代码来直接编辑它的内容。

以下是有关自定义图钉的良好信息来源:

http://msdn.microsoft.com/en-us/gg266447

于 2011-07-05T13:57:04.913 回答
1

利用System.Environment.NewLine

例如

Mypushpin.Content = "This is line one "+ System.Environment.NewLine + "and this is line two!";

于 2011-07-24T16:19:06.413 回答