xamarin-forms-samples | Sample apps built using the Xamarin.Forms | Form library
kandi X-RAY | xamarin-forms-samples Summary
kandi X-RAY | xamarin-forms-samples Summary
The samples in this repository demonstrate how to use different aspects of Xamarin.Forms to build cross-platform apps for iOS, Android, and the Universal Windows Platform (UWP). Please visit Microsoft code sample browser to download individual samples.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xamarin-forms-samples
xamarin-forms-samples Key Features
xamarin-forms-samples Examples and Code Snippets
Community Discussions
Trending Discussions on xamarin-forms-samples
QUESTION
I extract data from asynchronous method from API.
...ANSWER
Answered 2022-Mar-29 at 14:44your declaration of GetCustomPin is wrong, it should be
QUESTION
I want to fill the map with hard coded coordinates to display the pin markers with custom map using Xamarin.Forms.Maps
My HardcodeLocations class is:
...ANSWER
Answered 2022-Mar-24 at 10:27As Jason points out in the comments you need to change how you add items to the map.
QUESTION
I am having trouble with local notification on Android using Xamarin. The local notification shows every time the app is in the foreground or open. If I reboot the notification does not show. There is a RECEIVE_BOOT_COMPLETED
BroadcastReceiver
but I do not know if it is firing on reboot.
I cannot figure out what is wrong. I have tripled checked everything and feel like something small is missing.
Edit: I think I have it worked out for notifications on the app being closed thanks to this thread: Broadcast receiver not working when app is closed. Essentially, if debugging, the app needs to be reopened after closing it so that the receiver is called.
I used this doc to setup local notifications: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/local-notifications
AndroidManifest.cs
...ANSWER
Answered 2022-Mar-21 at 00:19I hate to delete a question from the internet.
The issue on boot received was using dependency injection in the boot receiver. Exception: You must call Xamarin.Forms.Forms.Init(); prior to using this property.
I just instantiated the class instead of using DI for this instance.
Here is what worked for me on the issue with the notification not showing when the app was closed: https://stackoverflow.com/a/60197247/814891
After registering my BroadcastReceiver (BR) statically in the manifest, applying the proper intent filters, using JobIntentService (and registering it in the manifest) to handle the work that was called from my BR, I was still getting inconsistent results.
Once all of what I listed above has been done you should be able to send an ADB command to activate your broadcast and process the work in your service even if the app is closed. This was working for me some of the time, but not all of the time.
This article describes limitation to BRs. "As of Android 3.1 the Android system excludes all receiver from receiving intents by default if the corresponding application has never been started by the user or if the user explicitly stopped the application via the Android menu" (AKA a user executes Force Stop)
When I start the app by debugging it, then swipe it closed on my device, my ADB command never activates my BR. However, after my debugging session is over, when I open up the app on my device and swipe it closed, I can activate my BR through ADB commands.
This occurs because when you debug an application, then manually swipe it closed on the device, Android considers this a Force Stop hence why my BR cannot be activated until I re-open the app on the device without debugging.
Scoured the internet for hours, and wasn't able to find my solution, so I thought I'd post it here just in case some poor unfortunate soul is encountering the same weird functionality I was.
Happy coding :)
QUESTION
I use project hybridWebView standart. Xamarin.Forms - HybridWebView Custom Renderer
- If i use the html file that is in the Android project - Content / index.html - Everything works.
- If I use html file which is hosted by mysite.com - The first time the hybridWebViewPage.axml page is loaded, I get the data in a variable
var data
. If I go to another page, and then go back to the hybridWebViewPage.axml page, I do not get data in the variablevar data
.hybridWebView.RegisterAction(data => DisplayAlert("Alert", "Hello " + data, "OK"));
Why is this happening?
...ANSWER
Answered 2021-Dec-27 at 02:18Because the hybridWebView.RegisterAction method is called in the construction method of the contentpage which will be called when you navigate to it first time. In addition, when you come back from another page, the construction method will not be called because the instance of it is still in the storge. There is the link about the navigation stack.link
QUESTION
I want to change pin icon when the pin is clicked.
I copy this code from my GetViewForAnnotation
method in OnDidSelectAnnotationView
but I don't know how to return annotationView
.
I'm not sure if this is the right way, but can I get an example of how to change the icon when I click on the marker?
...ANSWER
Answered 2021-Oct-29 at 09:42set the pin image in DidSelectAnnotationView,like:
QUESTION
I try to pass the CodeNum
object like parameter on query from this method:
ANSWER
Answered 2021-Jul-02 at 09:09Message can be sent by using MessagingCenter You can use MessagingCenter through the link below MessagingCenter
QUESTION
I want to call a object from other method in CustomMapRenderer
class in iOS project using this example
1. This is the method in which I call the object (I commented on it as a second line CodeNum
).
ANSWER
Answered 2021-Jun-30 at 04:05CustomPin GetCustomPin(MKPointAnnotation annotation)
{
var position = new Position(annotation.Coordinate.Latitude, annotation.Coordinate.Longitude);
foreach (var pin in customPins)
{
if (pin.Position == position)
{
int mapCode = int.Parse(pin.CodeNum);
var result = DataBaseConnection(mapCode);
MessagingCenter.Send>(this, "PinSelected", result);
return pin;
}
}
return null;
}
QUESTION
Because I failed to insert two more lines in Info Window on the pin on xamarin.forms.maps
on iOS project I managed to put them over Info Window like this:
In the android project I had two files with an extension .axml In which I added two and so I managed to add two more lines in InfoWindow on the pin.
But here I don't have (or don't know where) to add two more fields in the pin window itself so add them this way:
1. I add my objects who come from database with this code:
...ANSWER
Answered 2021-Jun-30 at 06:20The following code includes normal display of information, custom background color and font color,I hope it can help you.
QUESTION
I want to set second label in info window on xamarin map. I use this example.
So exactly I want to set one variable who come from date base on info window like a second label:
...ANSWER
Answered 2021-May-31 at 09:33You could get the CustomPin
with the GetCustomPin
method in the custom renderer like the sample in your above link.
QUESTION
I have an Xamarin.Forms application, and I want to show the user a Dialog Box with 2 options, one to accept and one to cancel. But DisplayAlert is not showing the buttons correctly. This is my code, I have tried WITH and WITHOUT the Device.BeginInvokeOnMainThread
...ANSWER
Answered 2021-Jan-21 at 17:17The problem was inside the Android Styles Themes. The colorAccent was #FFFFFF, that is why I didn't find it when searching for the word "White"
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xamarin-forms-samples
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page