【发布时间】:2016-12-25 06:09:36
【问题描述】:
我正在开发 XAMARIN 应用程序。我正在调用开放天气 API 并能够获得 JSON 响应。
字符串格式后,我可以在标题(标题)中显示城市名称+温度。
还是无法绑定图片图标。
在内容页面中有效的任何绑定图像,但在标题上无效。
这段语法来自我的 Tabbed Main Page .. 它调用了 City Tab Page。
<NavigationPage Title="City" Icon="city.png">
<x:Arguments>
<local:CityPage />
</x:Arguments>
</NavigationPage>
在 city.xaml.cs - 我正在调用这个方法。
public async void GetWeather()
{
Weather weather = await Core.GetWeather("07004");
if (weather != null)
{
this.BindingContext = weather;
string sWeather = String.Format("{0}°F", weather.Temperature);
this.Title = weather.Title + " " + sWeather;
}
}
图像图标必须出现在温度的末尾。
【问题讨论】:
-
请发布您的 xaml/代码的相关部分,以便我们看到您已经在做什么
标签: xamarin xamarin.forms openweathermap