开发者

How to add linebreaks in map pushpin content?

开发者 https://www.devze.com 2023-03-17 04:25 出处:网络
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:

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>

Than开发者_Go百科k you for your help


You can provide a template for the content of your pushpin:

<my:Pushpin>
    <StackPanel>
        .. your content here
    </StackPanel/>
</my: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


Use System.Environment.NewLine

eg

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

0

精彩评论

暂无评论...
验证码 换一张
取 消