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

In XF App PopModalAsync not invoking OnAppearing in called page on iOS13

$
0
0

A details page is called using

await Navigation.PushModalAsync(new NavigationPage(new DetailsPage(Item)));

The details page returns control to called page using

await Navigation.PopModalAsync();

Then on returning to the called page the OnAppearing() is invoked. This is still happening in Android app but not in app deployed to iOS13. But in iOS 12.x OnAppearing() is still invoked.

Any reasons? Is it a bug?


How to change menu icon in xamarin forms master detail page

$
0
0

I'm trying to change menu icon in master page in xamarin forms but nothing changing

this is my code

 public MainNavigationPage()
        {
            InitializeComponent();
            Detail = new NavigationPage(new TabPage());
            Master.Icon = "cart.png";
        }

and in xaml

<MasterDetailPage.Master>
        <ContentPage Title="Menu" Icon="cart.png">
            <StackLayout Padding="20">
                <!-- TODO: // Update the Layout and add some real menu items  -->
                <Button Text="ViewA" BackgroundColor="Black" Command="{Binding NavigateCommand}" CommandParameter="ViewA" />
            </StackLayout>
        </ContentPage>
    </MasterDetailPage.Master>

also i tried this solution in stackoverflow but unfortunately still the same problem

https://stackoverflow.com/questions/47286597/change-hamburger-icon-in-master-detail-navigation-xamarin-forms

XF 4.2.0.7 runs - 4.2.0.8 TypeLoadException on launch - Anyone else?

$
0
0

While updating a solution from 3.6.x up to latest I find no issues up to 4.2.0.778463
I've updated all the Android.Support.xx to 28.0.0.3
All good.

As soon as I update Forms to latest 4.2.0.815419 it crashes at runtime with a TypeLoadException.
No hints about what the type was... no break at a line of code... So there is little to follow through on. I'm thinking its the actual type of Application it doesn't like.

Anyone else run across this or have a hint?

Linking assemblies nightmare - Xamarin Forms - Android error

$
0
0

Hello, it's been a while since I did not have this kind of problem : building the app in release mode with a linking mode differentt to none throws an error which I'm unable to get rid off (neither SDK only nor SDK and User assemblies options work).

Here is the error I got while compiling (notice that I can't deploy and thus open device log to see advanced/more verbal logs.

System.InvalidCastException: Unable to cast object of type 'System.Byte' to type 'System.String'.
at Mono.Cecil.MetadataBuilder.GetConstantSignature(ElementType type, Object value)
at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
at Mono.Cecil.MetadataBuilder.AddField(FieldDefinition field)
at Mono.Cecil.MetadataBuilder.AddFields(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddTypes()
at Mono.Cecil.MetadataBuilder.BuildTypes()
at Mono.Cecil.MetadataBuilder.BuildModule()
at Mono.Cecil.MetadataBuilder.BuildMetadata()
at Mono.Cecil.ModuleWriter.<>c.b__5_0(MetadataBuilder builder, MetadataReader _)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func3 read) at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata) at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable1 stream, WriterParameters parameters)
at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, 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()

I don't see any clue on the project or the dll that is messing my project.

I've tried the linking.config approach where you specify a linker.description which is supposed to say to the compiler "don't touch those dll". But didn't manage to make it work.

At first, I thought it might be some dependencies not working but I found an old backup (6months ago) and it builds well in release mode with linking mode set to SDK only. I've tried to upgrade every packages from the project to match the packages' version I use in my project (the latest version). The old project seems to still compile fine in release mode with linking assemblies set to SDK...

I'm a bit lost. It's hard to find which dependencies got a problem since I need to do a ton of merge and additional work if I want to use the latest updates. I've tried to find some additional info on the web but couldn't find any tips.

I need help because my project goes from (linking SDK only) 66mo to 119mo. The gap is huge and I would like to release some updates without increasing the size by 80%... Users will think I've added massive new features whereas I did not :blush:

Any help or feedback on how you made it working will be much appreciate.
Thanks for reading so far.

If you a need any further information to help me, let me know ! Thanks again and have a good day.

Both Master and Detail not appearing on iOS 13 on the tablet.

$
0
0

Hello,

I got a problem with the MasterDetailView on the newest iOS 13. My app suddenly has problem when I updated my device to iOS 13 . I worked fine before. I made a small test project using the following code:

public App()
{
    InitializeComponent();

    var md = new MasterDetailPage()
    {
    Master = new Page() { Title = "Meester", BackgroundColor = Color.Red },
    Detail = new Page() { Title = "Leerling", BackgroundColor = Color.Green }
    };
    MainPage = md;
}

I still have the same problem.

Behaviour on Mobile:
View behaves as intended
The detail page that opens is Green.
When swiped from the left the detail page appears and this has the correct color Red.

Behaviour on Tablet
Bothe the master and detail keep being white and appear to have a size of -1, -1.
If i use contentpages the content of the pages is there in the object but just has no size.

I cannot find relevant information in the release notes of iOS 13. Does anybody know what the problem is?

WebView EvaluateJavascript passing a string parameter breaks escaping and makes JSON invalid

$
0
0

I am using EvaluateJavascript to pass serialized JSON to a JS-Method in my hybridWebView:

hybridWebView.EvaluateJavascript(string.Format(dataReceived+ "('{0}');", dataString));
to e.g.
function dataReceived(dataString){
JSON.parse(dataString)
}

The problem is, if the JSON data contains escaped characters, e.g. "value":"\"", the dataString is no longer valid for JSON.parse because the escaping is broken.
In the dataReceived it looks like: "value":"""

I found a similar issue described here: https://forums.developer.apple.com/thread/45643 and https://gist.github.com/MustafaFerhan/25906d2be6ca109f61ce

I tried the solution from the apple forums (Converting String to Base64 before passing and the convert it back using atob in the javascript) which tends to work for me.
But changing this way of passing the data would require me to change a lot of exisiting code on the Javascript side.

Is there a better/simpler way to preserve correct escaping when using EvaluateJavascript with a string parameter?

Thanks,
Stephan

Xamarin Forms Android Tabbed App don't reset navigation stack

Android Q Accessing External files.

$
0
0

I have an app with a feature to backup and restore its database. I create a file and saved it in external storage using this path:

return Android.OS.Environment.ExternalStorageDirectory.AbsolutePath

and allow the user to navigate to the directory they wish to save the file.

Everything worked exactly as I needed it to. I'm currently upgrading to the Android Q 10.0 framework and there are changes to external storage that no longer allows me to access this path. I'm looking into the private external storage, but I can't figure out a way to allow what I need.

Android.App.Application.Context.GetExternalFilesDir(null).AbsolutePath

Using the GetExternalFilesDir doesn't seem to persist uninstall.

Here are my objectives:

  1. I would like to be able to write the backup file, uninstall the app, re-install the app and restore from the backup.
  2. backup from current device, Install app on new device, copy file to new device, and restore the backup.

Any thoughts on how this can be achieved in Android Q 10.0? Any help will be greatly appreciated.


App Specific Password question

$
0
0

Lately (with the newest VS for Mac), every time I publish an app to the app store/testflight, it asks me for my Apple ID and app specific password.
Fine I log in and go generate a password.
Then i enter it and submit the app, everybody happy...
...Until next time...every single time it asks me for the same apple id and specific password.

Of course i forgot to write it down and i have to generate a new one. How can i get it to save and stop asking?? Has anybody figured it out??

Thanks!

Xamarin Forms Prism - navigation stops working when you change RootPage too many times

$
0
0

Steps to reproduce (according to attached sample):

  • Run app,
  • Navigate to Login Page (_navigationService.NavigateAsync("app:///Login") <- Login page is our RootPage
  • Hit Login
  • Navigates to master-detail MainPage (_navigationService.NavigateAsync("app:///Index/Navigation/Items") <- Index page is our RootPage
  • Navigate to About page
  • Go back
  • Hit Logout <- navigates back to Login Page (_navigationService.NavigateAsync("app:///Login") <- Login page is our RootPage
  • Hit Login
  • Navigates to master-detail MainPage (_navigationService.NavigateAsync("app:///Index/Navigation/Items") <- Index page is our RootPage
    [ISSUE] There is no possible to navigate to About page

Steps are the same after changing RootPage but _navigationService.GetNavigationUriPath(); is different doing it 1st time and in the next time ?

I do something wrong or there is a bug in Prism ?

I have checked NavigationStack and is ok.

Xamarin Forms every thing is slow

$
0
0

Hello friends i had built a xamarin form app for android i use mvvm pattern to built it , i use lazy loading in all pages there is only a few icons in resources folder
but the app is very slow from opening the app to the navigation even if the page is empty i heard the this was a problem in 2014 but we are now 2019 but i google it i never found the solution .

please any help
thanks

problem with android app and azure web app

$
0
0

I follow the instructions with the ZUMOAPPNAME (quickstart) and build for Xamarin.Forms and Azure SQL (through Azure Web App). Windows UWP and IOS works fine (debug and release), but Android always end up with data sync issue - "Invalid sync operation: The server did not provide a response with the expected content." - I tried updating to latest version of Xamarin.Forms, match the Support.v.4 .. also ran in to older version .... ran it under different android version - ran it with Visual Studio 2017 and Visual 2019 ..... at the end the ANDROID app ALWAYS load and run, except the data sync between app and azure web app has issue. Here is a twists - under Debug sometimes I can get the app to save the data but not sync back and display the item list, but under Release then neither save and sync works. I have been stuck for days on this. Anyone has suggestion ?

Can I do it more faster?

$
0
0

I'm using this foreach to upload data in my sqlite and this process requires 8 minutes to finish. Is there any way to make it more quickly? I ask, because if I put the line.. "_context.SaveChange();" out and beneath the forech, the process just need 22 seconds to finish but the data don't save in the data base

after upgrade to xcode 11 xamarin forms app not run on less version 12.x

$
0
0

Hi

I have a build a ios app using xamarin forms 4.1. it run successfully on ipad version 10.x before xcode upgrade. after upgrade to xcode 11 it run on version 12 perfect but dont run on version 10.x

Thanks

Default back button on Android

$
0
0

Hi, I need to send a message (DisplayAlert or any kind of popup) if the user press the default button to go back to the previous page, How can I warm the user when that happen? because if he does that all of data in the current page will be lose it and a need to warn him about that. Any idea?


Xamarin Forms Android app failing to Archive Release build that deploys and runs fine

$
0
0

*Posting this to help anyone who may find it and benefit from my time spent.**

On an app I've built in Archive Release mode many times, I started to get this error, but only when building in Release mode via the Visual Studio Build > Archive... menu.

Error:
this type of collectionview does not support changes to its sourcecollection from a thread different

I looked around and found many people stating that they'd fixed this archive build problem by closing VS, finding the hidden .vs folder and deleting it, reloading VS, and archiving again in Release mode. Some said to clean the solution. Some said to manually delete the Bin and Obj folders. I tried all combinations of these without effect - none of the wackiness worked out. After about 3 hours, I found a hint here, in this post which appeared to be for a build error unrelated to mine.

His pointer (that I wish to re-iterate here for the archiving build error above) was that in Project > Properties > Android Options > Use Shared Runtime had to be unchecked for BOTH Debug AND Release mode, or else the person had issues getting his app to build an Archive in Release mode. After hours of all kinds of trial and error, I found that turning off this switch in DEBUG mode (where I had not seen it enabled) was the fix to get rid of this Archiving build error. Not sure when this flag got enabled in my Debug config, nor when it started to matter for Release build Archiving.

Anyhow, hope this helps someone!

Environment:
Visual Studio 15.9.12
Xamarin 4.12.3.83

How do I rotate a image with a gesture recognizer? Why do they have swipe, pinch and such, but not r

$
0
0

How can I rotate an image with a gesture recognizer? With one finger. Do I have to use a pan recognizer?

Set Button ImageSource in Style

$
0
0

Hi, when I set the Button ImageSource property in a Setter, at runtime, when the app is starting, a Xamarin.Forms.Xaml.XamlParseException is raised:
"The PropertyName of Button.ImageSourceProperty is not ImageSource"

<OnPlatform x:Key="CustomFontFamily" x:TypeArguments="x:String">
    <On Platform="iOS" Value="CustomFont" />
    <On Platform="Android" Value="CustomFont.ttf#CustomFont" />
    <On Platform="UWP" Value="Assets/Fonts/CustomFont.ttf#CustomFont" />
</OnPlatform>

<FontImageSource x:Key="fis" 
                 Glyph="&#xe90e;"
                 FontFamily="{ DynamicResource CustomFontFamily }"
                 Size="26"
                 Color="Gray"
                 />

<Style x:Key="st_AbortButton" TargetType="Button">
    <Setter Property="ImageSource" Value="{StaticResource fis}"/>
</Style>

The exception is raised only if the code is in a ResourceDictionary inside a library.
If I put the same code in the ResourceDictionary of the Application.Resources all is ok.
I want to put all in a library for share it in many projects.

I don't understand where is the problem, any ideas?
Thanks

Xamarin.Forms CardsView nuget package

$
0
0

Hi all) I've released new package for Xamarin.Forms (Something like Tinder's CardsView)
Maybe, someone will be interested in it

nuget.org/packages/CardsView/ -- nuget
github.com/AndreiMisiukevich/CardView -- source and samples

Flip image first then go to next page

$
0
0

Found here how to flip a image vertical

https://xamgirl.com/plug-and-play-animations-in-xamarin-forms/

That works , but when i put it on my phone you don't see the flip en go's to the next page immediately ( or to fast i don't see the flip)

Can i change it so i see the flip til it is done en go then to the next page ? Maybe with a delay of some kind or execute and then .....

<Image x:Name="Firebaseimage" Source="Firebase" WidthRequest="40" HeightRequest="40"> <Image.Behaviors> <behaviors:ViewTappedButtonBehavior Command="{Binding OnLoginCommand}" AnimationType="FlipVertical"/> </Image.Behaviors> </Image>

And the Tap part

void OnTapGestureRecognizerTapped(object sender, EventArgs args) { var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += async (s, e) => { // handle the tap await Navigation.PushAsync(new Page1()); }; Firebaseimage.GestureRecognizers.Add(tapGestureRecognizer); }

Viewing all 89864 articles
Browse latest View live


Latest Images

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