Showing posts with label Xamarian. Show all posts
Showing posts with label Xamarian. Show all posts

Tuesday, 30 April 2019

Datepicker Seleted Date event in IOS mobile

DatePicker correctly work in Android while selecting date. Date_Selected event trigger when click on done button.

While in IOS mobile it's trigger everytime we change date or month or year.
if you want to trigger event only when click on Done button from Datepicker control.
Instead of Date_Selected event call Date_Unfocused event. It will work correctly


            if (Device.OS == TargetPlatform.iOS)
            {
                dtPicker.Unfocused += DtPicker_Unfocused;
            }
            else

            {
                dtPicker.DateSelected += DtPicker_DateSelected;
            }

Thursday, 29 November 2018

Open Google Map URL in iphone and Android using Xamarian

Open Google map url in Android phone.

  var uri = new Uri("https://www.google.com/maps/place/" + CustomerAddress.Replace("<br/>", ""));
                    Device.OpenUri(uri);


For android phone it is easy to open map. But for IOS device the code is different. First check if location service is turned on or off. The location service in iphone should be on.

Below is the code for IOS

   var name = Uri.EscapeUriString(CustomerAddress.Replace("<br/>", "").Replace("&", "and")); // var name = Uri.EscapeUriString(place.Name);
                    var request = Device.OnPlatform(string.Format("http://maps.apple.com/maps?q={0}", name.Replace(' ', '+')), null, null);
                    Device.OpenUri(new Uri(request));