2015-02-09 57 views
1

我創建了一個MapIcon,並使用Image屬性從項目中插入了一個圖像,但我看不到圖像,甚至是佔位符的名稱。 我錯在哪裏?如何顯示MapIcon的圖像?

MapLocationFinderResult result = await MapLocationFinder.FindLocationsAsync(muss.Indirizzo,null); 
Geopoint posizione1 = result.Locations.FirstOrDefault().Point; 
MapIcon arrivo = new MapIcon(); 
arrivo.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Flag.png")); 
arrivo.Location = posizione1; 
arrivo.Title = muss.NomeMuseo; 

MyMap.MapElements.Add(arrivo); 
+0

你確定圖像的名稱和位置?確保資產文件夾中有圖像。 – Kulasangar 2015-02-10 11:14:10

+0

我再次檢查,圖像的名稱是正確的。該圖像位於Assets文件夾中,幷包含在項目中 – SMM 2015-02-10 16:46:43

+0

使用#UWP CSharp映射控件並獲取當前位置https://youtu.be/xJveKt99MXY使用自定義圖像 – Sender 2016-06-22 16:58:17

回答

0

按照MapIconclass它僅支持WP8.1 Runtime應用。如果你在WP8應用程序中,那麼你爲什麼不爲你的地圖創建一個自定義的Pushpin

Custom Pushpins,在這篇文章中找到第三個選項,談論有一個圖像作爲Pushpin

+0

我正在創建Windows Phone 8.1應用程序。類MapIcon它工作,但它不工作的圖像屬性。我無法查看圖像 – SMM 2015-02-10 19:15:26

+1

@SMM您的代碼似乎沒問題,也許圖像的不透明度很高,請嘗試減少它。插入另一張圖片並查看。 – Kulasangar 2015-02-11 02:23:04