I want it to look like the photo on the right.
How can I make distances between them?
NavigationPage TitleView Template
Is there a way to know if user rated app?
Hello,
I implemented rating functionalities for both iOS and Android. In iOS, I used SKStoreReviewController and in Android, users directed to the Playstore.
Is there a way to know if user rated the app? If yes how can I know the point(or stars) user rated my app?
I want to show rating pop-ups to user if user rated less than 4 stars to my app in earlier version. Is this possible in both platforms?
Splash screen gif
Since xamarin 4.4 is around, they support .gif with is great for animating the splash screen of our app. The thing that I cant figure out is: how to figure out when the animation in over, so I can preform a transition.
Things I tried
- Creating a timer for the time of the animation, but since every phone is diferent, I tested in on a pixel 3 and it was perfect. I tested it on an Iphone and is was looping 3 times.
- keeping track with a bool like this
bool x = spashLogo.IsAnimationPlaying; if (x == false) { Debug.Write("ccc"); }
- Going to a website and modifying the count of the gif to be 1
Navigation from Login Page to Main Page (TabbedPage)
Hi Community,
I am really new in Xamarin and the whole dev-world.
I want to start with a Login-Page, after successfull login it goes to the Main Page, which should be tabbed with Navigation so I can select between different other tabs.
I have the problem that the Navigation at the top appear twice. The Logout button too.
Login.xaml.cs contains: Navigation.InsertPageBefore(new MainPage(), this);
await Navigation.PopAsync();
App.xaml.cs:
And the MainPage.xaml.cs:
What have I done wrong?
Thanks
riddler
Image Aspect AspectFill
Hello,
Coming across a sudden, new issue that I can't quite figure out. Loading an image and setting aspect to "AspectFill" within a set height. Was working well previously and actually same code works well on a different form. Now...only in Android, the AspectFill is not working. "Fill" will work.
<StackLayout Padding="0,5,0,0"> <Image x:Name="imgRoute" Aspect="AspectFill" HeightRequest="200" HorizontalOptions="Fill" Source="{Binding RouteThumbnail}" /> </StackLayout>
Any advice? Can't see what has changed and why it only affects Android; iOS displays image as expected.
Appreciate it.
Xamarin Forms... MVVM and Observable Collection Issue (perhaps)
I have built a prototype Forms App for Android. It's a potential replacement for a WebForms app. The concept is, I begin with a JSON file (as a datasource) for local non-internet functionality. This is a READ-ONLY file, from the users perspective... The data is retrieved and updated as needed from a web service... (the url is contained within each JSON Entity... When the app opens, there is default JSON information the app can start with... Then, there is a date field and some ModelView logic that retrieves new data as needed, and is updated in the "live" entity (that which was loaded initially). When the app Sleeps or Stops the current ObservableCollection is serialized to JSON, with any subsequent data changes and the file itself is saved...
Everything works as expected... Except... In the json file there are approximately 7 primary entities. Only 4 of them require regular updates because they have hot changing information... This I wish to display in a subset on the startup Navigation page in a marquee... I have all the bits in place and it all works, BUT only when the full list is queried...
ModelView (psuedo code)
PrimaryList = new ObservableCollection(FileOperastions.GetFullPrimaryLIst());
// GetFullPrimaryList returns a "list of primary model" items. I then bind this list to the binding context of the view, add it to the CarouselView in Xamarin and Walla! It works... As the background code on the primary thread executes, the Observable entities are updated from the URLs in the entity, and the displays are changed, viewable and subsequently saved... Perfect!
The problem appears to happen when I use a select query for only the 4 primary items that require notification... So;
PrimaryList = new ObservableCollection(FileOperastions.GetFullPrimaryLIst().Where(l => l.infourl.Contains("http")).ToList());
- My list now contains just the 4 entities in question as desired.
- The CarouselView displays these 4 entities as desired, and SOME of the entities show updates while others do not.
- Breakpoints in the WebClient DownloadStringAsync callback verify that the data is properly retrieved and the entity is updated properly...
- But, the data is not shown, as it is when the full list is in place...
has anyone else run into this issue? Do I need to raise a CollectionChanged event here... It's odd it does not work for a subset, but works for the full list... In terms of code... I change NOTHING else other than the line of code displayed above... I have tried creating a separate function of course, but whether it is a linq query as above or a function that returns a NEW list makes no difference... the result is the same... however, this also breaks the MVVM construct I am trying to stay within...
App is not resuming, Refresh everytime with splash screen in physical device.
Hi
I am working an application which is working fine on simulator but app is not resume after installed ipa in physical device.
Tried with these in Appdelegate
public override void WillEnterForeground(UIApplication application)
{
base.WillEnterForeground(application);
}
public override void OnActivated(UIApplication uiApplication)
{
base.OnActivated(uiApplication);
}
The "LinkAssemblies" task failed unexpectedly error while building the application
Hi,
I'm getting the below error while building the application using linking SDK assemblies option and with out shared runtime (as shared run time causing error while release the application.)
Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void System.Net.Http.HttpClientHandler/c__async0::MoveNext()' in assembly: 'System.Net.Http.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Net.WebHeaderCollection::AddValue(System.String,System.String)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() \Program Files\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1577
if shared runtime option is unchecked and link option none httpclient.GetStringAsync() method will raise the following error
Method 'System.Net.WebHeaderCollection.AddValue' not found.
but application is working fine when the shared runtime option is ticked and 'SDK assemblies only' link option selected in the android options tab.
I could find lot of similar threads but couldn't find any solution for this one.
Thanks,
Eins
SignaturePad within a template selector
Hello all, I am having an issue with my signaturepad (version 3.0) where when it is part of a data template, if I need to scroll, then it acts as if there is just one shared signature pad. That is, whatever change I do to one, affects the other one that is out of the screen's view. If they are side by side, then there is no problem
I was wondering if anyone has encountered this issue before. One interesting thing, I am not sure if that is just how selectors work, but ondisppearing is called each time the signaturepad is no longer visible within the screen (fair). However, OnAppearing is only called once for the initial render and never again.
Xamarin.Essentials reports wrong Orientation on emulator
I've created this very little application that should tell me the orientation of the device using Xamarin.Essentials. It works fine on my Huawei P30 Pro Phone. Is this an emulator related problem?
The Emulators are the Pixel_3_q_10_0_-_api_29 and tablet_m-dpi_10_1in_pie_9_0
Here's the code:
using System.ComponentModel; using Xamarin.Forms; namespace OrientationProblem { // Learn more about making custom code visible in the Xamarin.Forms previewer // by visiting https://aka.ms/xamarinforms-previewer [DesignTimeVisible(false)] public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); Xamarin.Essentials.DeviceDisplay.MainDisplayInfoChanged += DeviceDisplay_MainDisplayInfoChanged; Orientation.Text = Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Orientation.ToString(); } private void DeviceDisplay_MainDisplayInfoChanged(object sender, Xamarin.Essentials.DisplayInfoChangedEventArgs e) { Orientation.Text = e.DisplayInfo.Orientation.ToString(); } } } <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="OrientationProblem.MainPage"> <StackLayout> <!-- Place new controls here --> <Label x:Name="Orientation" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" FontSize="Large"/> </StackLayout> </ContentPage>
What's the best and easiest way to implement PayPal in a Xamarin Forms App?
Hi guys,
I would like to allow paypal, what's a good and easy way to do in Xamarin Forms?
Best regards
Chris
CarouselView and ListView issues
Hello!
I am using a CarouselView with a ListView inside to create a kind of "quiz". The user click on the ListView object, and that object changes color(background color through binding) and the value is stored in a variable.
My issue is that when the user swipes all the way to the right in the CarouselView and back again, the ListView have been drawn again, so the color have gone back to the original color. I solved this by changing the binding as well as the object, so when it is drawn again, that object will have the correct background. But when the user now changes the answer, the old selection does not change color because I am unable to access that specific object when the user clicks.
The way I am getting the cell is by using ViewCell tapped. I have tried with ListView ItemTapped aswell, but I am still unable to access the entire list of the Listview.
So, to solve this I need to find a way to stop the CarouselView and ListView to be drawn again or be able to access the entire list of a ListView when clicking on one of the objects, and this is probably the best option, but I have been unable to find out how.
I would love some assistance in this issue.
Thanks in advance!
Geolocation.GetLocationAsync doesn't work on Google pixel with only Emergency Location Service(ELS)
Hi,
I am using Xamarin Essential "Geolocation.GetLocationAsync" in my Xamarin forms project but this API doesn't work on "Google Pixel 2" if only Emergency Location Service is switched ON and "Google Location Accuracy" is switched OFF.
Any idea if "Google Location Accuracy" is mandatory to use "Geolocation.GetLocationAsync()" API?
Following are the Xamarin Forms and Xamarin Essentials packages which I am using on Google Pixel 2 (With Android 10 i.e. Android Q).
a. Xamarin forms version:
<package id="Xamarin.Forms" version="4.3.0.991221" targetFramework="monoandroid90" />
b. Xamarin Essentials version:
<package id="Xamarin.Essentials" version="1.3.1" targetFramework="monoandroid90" />
c. Android Version on Google Pixel 2:
Android 10.
Thanks.
Push Notification Plugin for Xamarin iOS and Android not working on IOS
Hello i am using https://github.com/CrossGeeks/PushNotificationPlugin with firebase clould massagees work fine on android but i cant get it work with ios if so oi move to use https://github.com/xamarin/GoogleApisForiOSComponents/blob/master/docs/Firebase/CloudMessaging/GettingStarted.md#add-firebase-to-your-app but still cant get it work this my code :
public override void OnActivated(UIApplication uiApplication) { base.OnActivated(uiApplication); if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0)) { // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate(); var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound; UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => { Console.WriteLine(granted); }); } else { // iOS 9 or before var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound; var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null); UIApplication.SharedApplication.RegisterUserNotificationSettings(settings); } UIApplication.SharedApplication.RegisterForRemoteNotifications(); }
Cloud not launch Xamarin.Launcher
Dear all,
I am facing an issue with the launch iOS simulator.
The following image appeared when I tried to debug.
How can I fixed it?
Environment
- macOS Catalina 10.15.4
- Visual Studio for Mac
=== Visual Studio Community 2019 for Mac === Version 8.6 (build 4520) Installation UUID: 436d9f64-9f6a-4a97-8b0c-f1f4848e6080 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638) Package version: 610000104 === Mono Framework MDK === Runtime: Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit) Package version: 610000104 === Roslyn (Language Service) === 3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3 === NuGet === バージョン: 5.6.0.6591 === .NET Core SDK === SDK: /usr/local/share/dotnet/sdk/3.1.300/Sdks SDK バージョン: 3.1.300 MSBuild SDK: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks === .NET Core Runtime === ランタイム: /usr/local/share/dotnet/dotnet ランタイム バージョン: 3.1.4 2.1.18 === Xamarin.Profiler === バージョン:1.6.15.68 場所: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler === Updater === バージョン: 11 === Apple Developer Tools === Xcode 11.5 (16139) Build 11E608c === Xamarin.Mac === Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version. === Xamarin.iOS === Version: 13.18.1.31 (Visual Studio Community) Hash: b3eedfed9 Branch: d16-6 Build date: 2020-04-09 10:22:36-0400 === Xamarin Designer === Version: 16.6.0.329 Hash: d4f8bcd13 Branch: remotes/origin/d16-6 Build date: 2020-04-24 02:16:02 UTC === Xamarin.Android === バージョン:10.3.1.0 (Visual Studio Community) コミット:xamarin-android/d16-6/3fe860a Android SDK: /Users/toyoshima takumi/Library/Developer/Xamarin/android-sdk-macosx サポートされている Android バージョン: インストールなし SDK Tools のバージョン: 26.1.1 SDK プラットフォーム ツールのバージョン: 29.0.5 SDK ビルド ツールのバージョン: 29.0.2 ビルド情報: Mono: 165f4b0 Java.Interop: xamarin/java.interop/d16-6@2cab35c ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.31.1@49232bc Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3 === Microsoft Mobile OpenJDK === Java SDK: /Users/toyoshima takumi/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 Android Designer EPL のコードは以下から入手できます。 https://github.com/xamarin/AndroidDesigner.EPL === Android SDK Manager === Version: 16.6.0.50 Hash: 5901879 Branch: remotes/origin/d16-6 Build date: 2020-04-30 04:01:22 UTC === Android Device Manager === Version: 16.6.0.95 Hash: 45d17b5 Branch: remotes/origin/d16-6 Build date: 2020-04-30 04:01:42 UTC === Build Information === Release ID: 806004520 Git revision: 9c92c7baceef7771f8dcf5c86e1e1a66fdc26182 Build date: 2020-05-18 10:05:00-04 Build branch: release-8.6 Xamarin extensions: 9c92c7baceef7771f8dcf5c86e1e1a66fdc26182 === Operating System === Mac OS X 10.15.4 Darwin 19.4.0 Darwin Kernel Version 19.4.0 Wed Mar 4 22:28:40 PST 2020 root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
HtmlLabelConverter with multiple links not working.
Adam Pedley posted a nice solution for converting html to a Label https://xamarinhelp.com/hyperlink-in-xamarin-forms-label/?utm_campaign=Weekly+Xamarin&utm_medium=email&utm_source=Weekly_Xamarin_166.
I extended the converter a bit and remove some bugs. It now also converts bold and italic tags as well as br and p-tag. The problem I run into is that when there are multiple links the click gesture does not work. It only works when there is 1 link.
using System; using System.Collections.Generic; using System.Globalization; using System.Text.RegularExpressions; using System.Windows.Input; using Xamarin.Forms; namespace LuisterrijkApp { public class HtmlLabelConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Label label = null; // label is used to set the FontSize for Bold and Italic if (parameter is Label) { label = (Label)parameter; } var formatted = new FormattedString(); foreach (var item in ProcessString((string)value)) { if (item.Type == "b") { formatted.Spans.Add(CreateBoldSpan(item, label)); } else if (item.Type == "i") { formatted.Spans.Add(CreateItalicSpan(item, label)); } else { formatted.Spans.Add(CreateAnchorSpan(item)); } } return formatted; } private Span CreateAnchorSpan(StringSection section) { var span = new Span() { Text = section.Text }; if (!string.IsNullOrEmpty(section.Link)) { span.GestureRecognizers.Add(new TapGestureRecognizer() { Command = _navigationCommand, CommandParameter = section.Link }); span.TextColor = Color.Blue; // Underline coming soon from https://github.com/xamarin/Xamarin.Forms/pull/2221 // Currently available in Nightly builds if you wanted to try, it does work :) // As of 2018-07-22. But not avail in 3.2.0-pre1. // span.TextDecorations = TextDecorations.Underline; } return span; } private Span CreateBoldSpan(StringSection section, Label label) { var span = new Span() { Text = section.Text, FontAttributes = FontAttributes.Bold }; if (label != null) { span.FontSize = label.FontSize; } return span; } private Span CreateItalicSpan(StringSection section, Label label) { var span = new Span() { Text = section.Text, FontAttributes = FontAttributes.Italic }; if (label != null) { span.FontSize = label.FontSize; } return span; } public IList<StringSection> ProcessString(string rawText) { rawText = rawText.Replace("<br>", "\n"); rawText = rawText.Replace("<br/>", "\n"); rawText = rawText.Replace("<br />", "\n"); rawText = rawText.Replace("<p>", "\n"); rawText = rawText.Replace("</p>", "\n"); const string spanPattern = @"(<[abi].*?>.*?</[abi]>)"; MatchCollection collection = Regex.Matches(rawText, spanPattern, RegexOptions.Singleline); var sections = new List<StringSection>(); var lastIndex = 0; foreach (Match item in collection) { var foundText = item.Value; sections.Add(new StringSection() { Text = rawText.Substring(lastIndex, item.Index - lastIndex) }); lastIndex = item.Index + item.Length; var html = new StringSection() { Link = Regex.Match(item.Value, "(?<=href=\\\")[\\S]+(?=\\\")").Value, Text = Regex.Replace(item.Value, "<.*?>", string.Empty), Type = item.Value.Substring(1,1) }; sections.Add(html); } sections.Add(new StringSection() { Text = rawText.Substring(lastIndex) }); return sections; } public class StringSection { public string Text { get; set; } public string Link { get; set; } public string Type { get; set; } } private ICommand _navigationCommand = new Command<string>((url) => { Device.OpenUri(new Uri(url)); }); public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } }}
How to change circle color of RadioButton for Android?
AppCompatRadioButton is inside. How can we change the color of circle and border around it?
Add views on top of map, but right on the defined position
Hey guyz. Currently i am developing a taxi app. But got to the point where i need to put some views on top of the map that will move when i move me map. I am wondering how it is possible to do it using Xamarin.Forms.GoogleMaps package. The inbuilt "Icon = BitmapDescriptorFactory.FromView()" won't work for me because i need a view that consists of two or more clickable parts + i don't want the views to overlap. Adding a picture of what i need to achieve. Any help would be appreciated
How to change imagesource property in an ImageButton when touched
Hi,
I need to change "source" and "opacity" property of an "ImageButton" when touched/clicked using XAML Style.
Can someone help ?
Regards
data transfer between pages
First I am beginner for Xamarin, i want to transfer data Mainpage to Page1 I wrote code but it is not working please help me. Code is below;
MainPaage
`public partial class MainPage : ContentPage
{
public string deg3 { get; set; }
public int deg4 { get; set; }
public MainPage()
{
InitializeComponent();
deg3 = entry3.Text;
}
private async void nextpage_Clicked(object sender, EventArgs e) { await Navigation.PushModalAsync(new NavigationPage(new Page1())); new Page1 { deg1 = deg3 }; } }`
Page1
` public partial class Page1 : ContentPage
{
public string deg1 { get; set; }
public int deg2 { get; set; }
public Page1() { InitializeComponent(); } private void degeral_Clicked(object sender, EventArgs e) { entry1.Text = deg1; } }`