Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 79144 articles
Browse latest View live

frame1_ChildAdded event not firing after some time

$
0
0

Dear All,

I have a frame name frame1 inside a collectionview. Whenever new item is inserted it should fire event. But its not firing this event sometimes. I want to show alert and highlight newly added item whenever new item is added to observable collection using SignalR

Thanks


Xamarin iOS is not working on release mode

$
0
0

I am trying to generate an archive of my iOS project but I can't, everything is working fine on debug mode but when I go to release mode the process fails, I am getting this error:

/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: The "XamlCTask" task failed unexpectedly.
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: Mono.Cecil.Cil.SymbolsNotFoundException: No symbol found for file: /myproject/test/obj/iPhone/Release/test.exe
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: Server stack trace:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.Cil.DefaultSymbolReaderProvider.GetSymbolReader (Mono.Cecil.ModuleDefinition module, System.String fileName) [0x000a4] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00032] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 /myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 /myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 /myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Xamarin.Forms.Build.Tasks.XamlCTask.Execute (System.Collections.Generic.IList1[System.Exception]& thrownExceptions) [0x0023e] in <194637163a754df3b62b8bf9aa013363>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Xamarin.Forms.Build.Tasks.XamlTask.Execute () [0x00000] in <194637163a754df3b62b8bf9aa013363>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at (wrapper remoting-invoke-with-check) Xamarin.Forms.Build.Tasks.XamlTask.Execute()
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at (wrapper xdomain-dispatch) Xamarin.Forms.Build.Tasks.XamlTask.Execute(object,byte[]&,byte[]&)
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: Exception rethrown at [0]:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at (wrapper xdomain-invoke) Xamarin.Forms.Build.Tasks.XamlTask.Execute()
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:575
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:818

Here are my computer details

=== Visual Studio Enterprise 2019 for Mac ===

Version 8.6.5 (build 23)
Installation UUID: 65aaf5c2-46d5-4ee1-9383-d27decdcf313
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 ===

Version: 5.6.0.6591

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.301/Sdks
SDK Versions:
3.1.301
3.1.300
3.1.200
3.1.102
3.1.101
3.1.100
3.0.101
3.0.100
2.2.300
2.2.103
2.1.505
2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.5
3.1.4
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.2.5
2.2.1
2.1.19
2.1.18
2.1.17
2.1.15
2.1.14
2.1.13
2.1.9
2.1.2

=== Xamarin.Profiler ===

Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.5 (16139)
Build 11E608c

=== Xamarin.Mac ===

Version: 6.18.2.1 (Visual Studio Enterprise)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:04-0400

=== Xamarin.iOS ===

Version: 13.18.2.1 (Visual Studio Enterprise)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:05-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 ===

Version: 10.3.1.4 (Visual Studio Enterprise)
Commit: xamarin-android/d16-6/3a10de9
Android SDK: /Users/oscarumc/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.6
SDK Build Tools Version: 29.0.2

Build Information:
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 OpenJDK for Mobile ===

Java SDK: /Users/oscarumc/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:

=== Android SDK Manager ===

Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:42:50 UTC

=== Android Device Manager ===

Version: 16.6.0.96
Hash: 6e8b80b
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:43:28 UTC

=== Build Information ===

Release ID: 806050023
Git revision: 5289d413b99fddfc20b4ecf3e445ccb822213427
Build date: 2020-06-18 12:08:30-04
Build branch: release-8.6
Xamarin extensions: 5289d413b99fddfc20b4ecf3e445ccb822213427

=== Operating System ===

Mac OS X 10.15.5
Darwin 19.5.0 Darwin Kernel Version 19.5.0
Tue May 26 20:41:44 PDT 2020
root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64

Getting (com.apple.AuthenticationServices.AuthorizationError error 1000)

$
0
0

Getting (com.apple.AuthenticationServices.AuthorizationError error 1000) on calling AppleSignInAuthenticator.AuthenticateAsync(). I added apple signin key 'com.apple.developer.applesignin' in Entitlements as documented. But i'm getting access token from WebAuthenticator.AuthenticateAsync(authorizationUrl, callbackUrl)

ListView Grouping issues on UWP

$
0
0

I am facing two issues with grouping in ListView on UWP. They are:

  1. In Group Header by default it shows the GroupShortNameBinding rather than the GroupDisplayBinding (which is the default for Android & iOS). I can get to display the GroupDisplayBinding only if I define a GroupHeaderTemplate. Is that the only way?
  2. If leave it to the default settings, tapping on a group header shows the single letter based jump list. But if I use the GroupHeaderTemplate, tapping a group header clears the screen and the app hangs. How can prevent taps on group header, as I don't need have a jump list?

I did find some threads in this forum on ListView grouping. But it appears they never had these issues as no one reported it. Is it a recent issue or am I the only one having it?

Fly Item To Cart Tab in Tabbed Page

$
0
0

I want to fly an item to cart tab in cart page on item image clicked..Is there any way to implement it in xamarin forms? I need it..plz help

Service doesn't work when device sleeps

$
0
0

I've built a simple service which works fine.

public class FibonacciJob : JobService
{
    public override bool OnStartJob(JobParameters jobParams)
    {
        int x = jobParams.Extras.GetInt("secondsToWait", -1);

        Task.Run(() =>
        {
            Thread.Sleep(1000*x);
            JobFinished(jobParams, false);
        });            
        return true;
    }

    public override bool OnStopJob(JobParameters jobParams)
    {
        return false;
    }
}

The calling to the service is done by the next class:

    public class Class1: I1
    {
        public const string JobSchedulerService = "jobscheduler";
        public void F1(int seconds)
        {
            var instance = MainActivity.Instance;

            Java.Lang.Class javaClass = Java.Lang.Class.FromType(typeof(FibonacciJob));
            ComponentName component = new ComponentName(instance, javaClass);
            var jobParameters = new PersistableBundle();
            jobParameters.PutInt("secondsToWait", seconds);

            JobInfo.Builder builder = new JobInfo.Builder(1, component)
                                                 .SetMinimumLatency(10000)   
                                                 .SetOverrideDeadline(10000) 
                                                 .SetExtras(jobParameters);

            JobInfo jobInfo = builder.Build();

            JobScheduler jobScheduler = (JobScheduler)instance.GetSystemService(JobSchedulerService);
            int result = jobScheduler.Schedule(jobInfo);        
        }
    }

The problem is that when I switch the phone to sleep mode (click the button on the device's side, so the screen is turned off),
the service doesn't work- the SetOverrideDeadline(10000) will not be taken in account.
Nothing will happen no matter how much time will pass.

How can I cause the service to start after X time (Lets say 1 hour) , no matter if the device sleeps or not.

Why is it necessary to re-install a NuGet package for an existing class?

$
0
0

I'm curious why this is necessary and wonder if my understanding is at fault. I have installed the NuGet package Xam.Plugin.Media within an existing solution that was already in development. I installed it for the solution and the Android project, before making any code changes. When I then insert my code from another separate and already-working application, it doesn't recognise the references to the NuGet package even though it's already installed for this solution:

using Plugin.Media;
using Plugin.Media.Abstractions;

if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) {  }

I then follow its offer to auto-correct, and it shows within the drop-down menu that there is a local version 5.0.1 already. Choosing this rectifies the problem, but as far as I can see there is no code change to my class as a result of this. What has it done to my solution in order to resolve this? Does this mean that NuGet packages and versions are specific to each class? If so, where is this information stored? Image of the whole thing is below, showing the menu.

Random WebService Timeouts

$
0
0

I am getting random webservice timeouts and I can't figure out why, it is only happening when calling the webservice from the Xamarin app. If I test the webservice in SoapUI, and even spam it with requests, I get 100% success and return values. But when calling the same webservice in Xamarin about 30% of the calls never return and eventually timeout. But on the backend I and see the calls 100% of the calls made it to the webservice and worked, but Xamarin isn't getting the response 30% of the time.

Webservice is C# asmx webservice, which is added via the connected services in the Xamarin project.

The call is pretty simple

PhoneWSServiceReference.PhoneWebServiceSoapClient wsclient = new PhoneWebServiceSoapClient(EndPointName); WSHelper.SetWSTimeOut(ref wsclient, 20); BaseResponse response = wsclient.UserLogin(UserName, Password);

But 30% of the time I get "System.TimeoutException: 'The operation has timed out.'"

I am using the IsBusy flag, setting it to true just before the webservice call and false after it. Is there a better way to call the asmx webservices?


Customize ListView

$
0
0

Hey,

I want to create a custom cell which should describe a transaction (like a banking app). The transactions should be group by there date.
The cell should look like the one in the attached photo.

My question is, is this possible with Xamarin.Forms?

I could create a cell with space between them using the DataTemplate for the ListView but there are two other major problems:
- How can I customize the grouping header (Label and Background) from the ListView?
- How can I change the selected background to only apply on my custom frame (not the entire cell, because I use space between them by "actual" cell
is a view inside the cell with margins around them)?

Is it better to use a Scroll view with custom views like cards for this? What is the performance of a ScrollView is like when there are many cells/views in there?

I have searched a lot but don't find anyone who is using such cells...

Thanks for your help!!

Flo

How to send image to api using image path

$
0
0

I have this method that gets image from device storage and send it to api

var media = CrossMedia.Current;
var file = await media.PickPhotoAsync();

        // wait until the file is written
        while (File.ReadAllBytes(file.Path).Length == 0)
        {
            System.Threading.Thread.Sleep(1);
        }

        var content = new MultipartFormDataContent();

        content.Add(new StreamContent(file.GetStream()),
            "\"file\"",
            $"\"{file.Path}\"");

        var httpClient = new HttpClient();

        var httpResponseMessage = await httpClient.PostAsync(URL, content);

How to do this using image path without getting image from device storage

How to get the serial number for a device with android 10 (API level 29)?

$
0
0

Hello,

As you can read here, https://developer.android.com/reference/android/os/Build#getSerial(),
from API level 29 and after, asking for the device's serial number throws an exception.

Is there a way to get the serial number from a device regardless of its API level?

Or is there a unique identifier of the device, that he will remain forever the same, and that its available to the user and to me (by code)??
I want the user to give me the identifier so I can register the device manually, but after that I want to read the identifier for the code...

My app maybe installed to user's personal phones so I do not want anything special like profile owner or root apps or stuff like that...

Thanks!!!

WebView.EvaluateJavaScriptAsync always null

$
0
0

I'm trying to use WebView.EvaluateJavaScriptAsync.

I'm just using this page to test with

If you try it in Chrome and in the debug console type
myFunction(123, 456)

It says "56088".

But in Xamarin.Forms if I do:

string result = await webView.EvaluateJavaScriptAsync($"myFunction(123, 456)");

result is always null

I can do other things, and they work fine:

string result2 = await webView.EvaluateJavaScriptAsync("27 + 92");
string result3 = await webView.EvaluateJavaScriptAsync("alert('hey')");
string documentBodyInnerHTML = await webView.EvaluateJavaScriptAsync("document.body.innerHTML");

Anyone know how to get this working?

Xamarin.UITest

$
0
0

Hi All,

is there a way how to verify in UI test that for example only three elements are on screen.

So for example I have something like this:

I want to verify that only those three options are on screen. So for example when there would be 4th option there test would fail.

Thank you.

Is it possible to add android zoom buttons on only one webview?

$
0
0

I have one web view where I need the zoom buttons enabled, but they look tacky and get in the way of other web views.

I know how to set the zoom buttons up using this.Control.Settings.SetSupportZoom(false); ,
but it applies to every single web view.

In my CustomWebViewRenderer I have no way to reference what url I'm actually using to open the webview. Instead, the url just returns "file:///android_asset/"

Any ideas of how I co do something like...

if(url == "example.com")
this.Control.Settings.SetSupportZoom(true)
else
this.Control.Settings.SetSupportZoom(false)

It doesn't have to be exactly that, just the same effects.

How to integrate sage pay in xamarin form app?

$
0
0

I wanted to integrate sage pay in my xamarin form app. Is there tutorial available for integration sage pay?


Xamarin WebView loose the cookies

$
0
0

I have a Xamarin application, this one contains a WebView.

The page I navigate to add some cookies, not only at load but also with some dynamic Javascript, the problem is when I leave and restart the application, all my cookies are lost! I don't know why they are not persisted by default! I'm surprised about this behavior!

Currently, I have a custom renderer for both IOS & Android, so one possible solution is to retrieve all the cookies when we leave a page, but I cannot
find any event called when we leave a page :-(

PS: I know that some peoples are playing with WebView, but I can't find a way to persist/restore the cookies created by the web site I browse too!
Noticed that I'm interested only by Android & IOS.

Shell: Is BackgroundImageSource working on Android?

$
0
0

I am trying to get a background image working with Shell on Android - no luck so far.
The same embedded image displays if used as FlyoutBackgroundImage, so I know the embedding works.
Is BackgroundImageSource even supported with Shell?

Collapse Expander control with data binding

$
0
0

TabbedPage with multiple ContentPages, and each ContentPage contains one or more Expander controls. What I would like to do is to collapse all Expander controls on a given ContentPage once the user switches to a different Tab, so if they return to the previous Tab all of the Expander controls will be reset to their original Collapsed state. I would like to use MVVM approach with DataBinding and NOT use CodeBehind.

How can I accomplish this?

About pinch processing in SKCanvasView

$
0
0

I want to perform pinch processing with the code below, but it is not working properly.

I want to get the value of the first Location with "SKTouchAction.Pressed:", compare the first value with the last value with "SKTouchAction.Released:", and perform "zoom in" or "zoom out" processing. is.

private void Handle_Touch(object sender, SKTouchEventArgs e)
{

    try
    {

        switch (e.ActionType)
        {
            case SKTouchAction.Pressed:

                previousPoint.X = e.Location.X;
                previousPoint.Y = e.Location.Y;

                break;

            case SKTouchAction.Entered:
                break;


            case SKTouchAction.Moved:

                break;

            case SKTouchAction.Released:


                if (dragDictionary.Keys.Count > 1)
                {

                    if (e.Location.Y < previousPoint.Y)
                    {
                        //zoom in processing
                    }
                    else
                    {
                        //zoom out processing
                    }
                }
                else
                {
                }

                break;

            case SKTouchAction.WheelChanged:

                break;

            case SKTouchAction.Cancelled:

                break;

            case SKTouchAction.Exited:

                break;

        }
        e.Handled = true;
        ((SKCanvasView)sender).InvalidateSurface();
    }
    catch
    {
    }

}

is there a Tabbed view in Xamarin.forms?

$
0
0

Hello,
any idea how to make a Tabbed view in xamarin.forms,
i only found Tabbed page which is not possible to put it inside a content page!

choosing Xamarin.forms is bad choice? should i've used each platforme beside with xamarin.android and xamarin.ios!

Thanks in advance

Viewing all 79144 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>