Disragarding the conversion °F<->°C you can use the format string to display whole numbers only
<Label x:Name="tempLabel"
Text="{Binding Temperature , StringFormat='{0:F0}°F'}"/>
(please note, that I moved the 'F' within the quotation marks in order to be displayed correctly). The F0
format string is a fixed decimals floating point formatter with zero decimals. F1
would have one decimal number, F2
two and so on. If you'd like to read more about the format strings for numbers, please see here.
To convert the °C value to °F you could for example use an IValueConverter
(see here), or convert the value directly in your viewmodel.
EDIT
I missed the point that Temperature
was a string
. In order to use the number formatting, Temperature
has to be a number. Convert it the following way
weather.Temperature = double.Parse((string)results["main"]["temp"])
(of course you'll have to change the type of the Temperature
property to double?
);