hey guys as the title state, im trying to return both logitude and lattiude from my mapclicked event to my view model. here my attempt, but it didnt work.
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var mapClickedEventArgs = value as Xamarin.Forms.Maps.MapClickedEventArgs;
var currentPossition = mapClickedEventArgs;
var lati = currentPossition.Position.Latitude;
var longi = currentPossition.Position.Longitude;
return lati;
}
You can use 2 good approaches:
Note, I wasn't sure what is the data type of
lati
&longi
so I assumed it is of typedouble
. In case it is a different type, please change the return values fromdouble
to the relevant type.Position
class or create your own class that will include the propertieslati
&longi
and instead of returning anobject
, return this class. The last row will be something like:Or:
UPDATE:
Maybe, I didn't understand the question right. Maybe you can't change the method signature.
If this is the case, you can just return it using anonymous types: