Xamarin Forms Maps - Custom Pin Images - xamarin.forms

Is there a way to change the image of the pins in Xamarin Forms Maps. I want to make the pin a custom image, if it has to be done natively, can someone give me a simple example of it. Thank you.

To anyone coming to the later, this is now well supported in Xamarin Forms.
In essence you need to create a custom map class in your PCL or shared code that inherits from the Xamarin Forms Map and then create a Custom Renderer in each of the platforms' projects.
Those custom renderers will be different for each platform, dealing with the specifics of rendering icons and any pop up information shown when you click on that pin for that particular platform. You are not obliged to create a custom renderer for all platforms, for any that you don't a normal map will be displayed.
This is all now really well documented in the Custom Renderers | Customizing a Map section of the Xamarin Forms Developers Guide. That documentation walks through creating a custom renderer for Android, iOS and UWP and explains the code needed in detail. There's a lot of it, so I won't reproduce it here. There is also an accompanying sample solution here.
One point worth noting is that if you are trying to reproduce that code in your own project you will also need to add the images in the various drawable folders in the ProjectName\Droid\Resources directory, and also the two axml files in the layout directory.

Apparently this is quite locked down and you have to look at custom renderers to achieve what you are needing.
There is a discussion about this on the following link:-
http://forums.xamarin.com/discussion/17916/customization-of-xamarin-forms-maps-pins
, with specific reference to a project at the following link which someone has implemented custom image pins from the Assets folder:-
https://github.com/paulpatarinski/ShouldIWashMyCar/blob/master/Android/Renderers/MapViewRenderer.cs
I haven't tried this yet, however this would probably be a good place to start when looking to customize map rendering.

This project might be helpful to you. raechten/BindableMapTest
From the description:
Small sample for binding a collection to a Xamarin Forms Maps pins
(valid until binding directly to the Pins property will be supported
by Xamarin Forms directly).
Includes custom and clickable pins.
It has Android and iOS implementations.

Related

what approach to use a specific component that is only available for iOS or WPF or android in Xamarin Forms?

what approach is used to create a specific component that is only available for one platform?
Can I use Custom Renderer or DependencyService or any other approaches is there ?
If you want to set the UI desinger on a specific control or layout .Such as entry or button.You can use custom renderer.
Custom renderers provide a powerful approach for customizing the appearance and behavior of Xamarin.Forms controls. They can be used for small styling changes or sophisticated platform-specific layout and behavior customization. This article provides an introduction to custom renderers, and outlines the process for creating a custom renderer.
And you can use DependencyService if you
just want to call some native API .
DependencyService allows apps to call into platform-specific
functionality from shared code. This functionality enables
Xamarin.Forms apps to do anything that a native app can do.
And you can also use Effects.In some cases, all three can help you implement your requirements.
There are some relevant cases that use one of them to solve the issue.I hope they can help you better understand their differences and usage, and how to choose them as a solution in specific cases.
CustomRenderer case
DependencyService case
Effect case

Xamarin Templates -IOS

I am currently learning app-building basics with Xamarin. My question is what is the difference between "Blank-App (iPhone)" and "Master-Detail App (iPhone)".
Thanks for taking the time to answer my question.
These are two different templates for you to choose.
Blank-App (iPhone) means you just create an empty project without storyboard, RootViewController or other extensions. You can customize it whatever you want. If you are new to Xamarin.iOS and unsure about what template to use, try to use Single View Application.
Master-Detail App (iPhone) means when you choose this template. System will automatically create a UISplitViewController with a default Detail and Master for you. So there's no need to configure the rootView. It's a type of showing the ViewController.
You can try to create these two template projects then run to see the difference between them.

Is there an orthodox way to develop Android TV apps

I have a few problems with understanding of android tv development. First of all when i had launched android tv project and was trying to create custom interface for new activity, unfortunately i couldn't find any xml elements which could help me. From the example i got some ideas that whole interface provided by android SDK collected in many fragments. I just can modify colors, fonts, fonts size, transparency maybe animation and etc. But if i really need to customize structure of controls and WTF i wanna output "Hello World" inside label!!! Is it possible? I read all articles from this link https://developer.android.com/training/tv/index.html but it is still useless for me (maybe I am unique :) ). After this suffering with google guide, i have done a conclusion that the platform so new and there is no way to do some thing except only way that was provided by google. Am i right? If not, what should i do to find successful way?
The fragments provided by Google as part of the "leanback" framework are templates designed to make it easy for content providers to start publishing to Android TV without having to worry about the technical details of building a TV UI. The idea is that a content provider can create a channel just by feeding in their video content. This ease of use comes at a cost, customization is difficult or impossible with these templates.
However there is nothing preventing you from creating your own Activities and Fragments from scratch and implementing a completely custom UI for the TV, it works just like any other Android device. Add "android.intent.category.LEANBACK_LAUNCHER" to your manifest and see for yourself.

How to add overlay text to camera screen in xamarin forms?

I would like to add an overlay to the camera.How can it be done in xamarin forms
The ultimate answer is always that you can write a custom renderer for your camera control and add the overlay using you platform native capabilities.
For a Xamarin.Forms solution that doesn't involve custom renderers it is important to know what camera control you are using to begin with.
If you are using the XLabs camera control you could inject your custom MediaPicker.cs directly after registering the service.
A customrenderer is the answer. You could easily use AVFoundation, see this blog post that got me going https://blog.xamarin.com/how-to-display-camera-ios-avfoundation/.
I did this by creating a custom control following the steps in this link: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/view
It's very basic and you'll need to add more things to have a full usable camera, but it's a good start.
There is a discussion around the focus for that camera in here: Camera Using custom Camera Preview Renderer is not clear

Sample with Xamarin.Forms and Vuforia?

Where can I find a working example that uses the library "Vuforia" in Xamarin.Forms portable (Droid+iOS) for WinPhone I know that does not work?
Or working converted library for specific platform?
From what I understand. Xamarin is for Custom Touches and UI. So when it comes to Vuforia, the only feature it is going to use is the augmentation.
Hence, if you want to use Xamarin for it's functionalities, you can do so but it will not interfere with the Vuforia virtual touch buttons.
I hope this is what you asked for. Examples this specific aren't available online, I would think.

Resources