2011-07-05 42 views
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> 

謝謝您的幫助

回答

2

您可以爲您圖釘的內容提供了一個模板:

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

注意,圖釘的默認屬性(即ContentControl中)它是「內容」,所以你可以通過在標籤之間添加代碼直接編輯它的內容。

以下是有關自定義圖釘的良好來源:

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

+0

謝謝你的鏈接,它可能是有用的某個時候! – enkara

1

使用System.Environment.NewLine

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