上午有一個場景,其中i有一個BaseImageUrl
字符串
private const string BaseImageUrl = "http://eamobiledirectory.com/cooperp/Images/app_images/";
綁定兩個字符串(串聯)在圖像Xamarin.Forms
對於i希望檢索到Image
視圖Xaml
加上串接圖像它具有精確的圖像名稱forexampleflower.jpg
和反序列化JSON後得到,它是作爲一個列表的字符串值office_photo
,下面是我的模型類:
public class Adverts
{
public string office_photo { get; set; }
public DateTime entryDate { get; set; }
}
所以我想要的是如何連接BaseUrl
和office_photo
在XAML
,以便我得到圖像的完整鏈接。
是我在ListView圖片:
<ListView x:Name="listViewTest" HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Image Aspect="AspectFill" Source="{Binding office_photo}" x:Name="advertImage"
WidthRequest="200"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
請問如何用代碼顯示 –
已更新我的答案。我在手機上,所以請原諒任何錯別字... –
非常感謝,它的工作哇 –