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

Multiple projects with the same XAML files

$
0
0

I have a few apps that have similar views, with different branding. How can I reuse the same XAML files?


Is it possible (easy?) to change the background color on a Xamarin.Forms Android Date Picker?

$
0
0

Is it possible (easy?) to change the background color on a Xamarin.Forms Android Date Picker? Right now it is hot pink. Ugh.

Missing templates

$
0
0

I'm missing an option to create Resource Dictionary on my Add window.

On my visual studio installer I have "Mobile development with .NET" installed.

Just in case this are the other things installed

  • .NET desktop development
  • Desktop development with C++
  • ASP.NET and web development
  • Visual Studio Extension

System.InvalidCastException on the Main.cs IOS

$
0
0

I am getting this exception System.InvalidCastException on IOS, and my Android project runs fines

here is the stake track:

" at Xamarin.Forms.Platform.iOS.NavigationRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00007] in :0 \n at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in :0 \n at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00008] in :0 \n at Xamarin.Forms.Platform.iOS.NavigationRenderer+d__45.MoveNext () [0x00016] in :0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 \n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 \n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 \n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 \n at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 \n at Xamarin.Forms.Platform.iOS.NavigationRenderer+<b__40_0>d.MoveNext () [0x00067] in :0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 \n at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018 \n at UIKit.UIKitSynchronizationContext+c__AnonStorey0.<>m__0 () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/UIKit/UIKitSynchronizationContext.cs:24 \n at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/Foundation/NSAction.cs:163 \n at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)\n at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/UIKit/UIApplication.cs:79 \n at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.1.28/src/Xamarin.iOS/UIKit/UIApplication.cs:63 \n at MyScooterDrinks.iOS.Application.Main (System.String[] args) [0x00002] in /Users/siphomario/Desktop/MyScooterDrinks/myscooterdrinks/MyScooterDrinks/MyScooterDrinks.iOS/Main.cs:19 "

HybridWebView sample with local html file as embedded resource in NetStandard class library

$
0
0

Can anyone help me with a HybridWebView sample able to open a local html file, available as embedded resource in a referenced NetStandard class library ?

MasterDetailPage - page data is lost when navigated to another detail page

$
0
0

I have an MD page with 3 detail pages (of which each of them are of type ContentPage)

The problem I have now is that when the user navigates to another detail page, the data on the current page are lost (which is not fine) and when the user goes back to that page, it's like it's initialised all over again (which is fine)

Now, I am looking to find a way to raise an event on the detail page to realise when the page is left so that I can save data accordingly.

I know how to do it on the MasterDetailPage by accessing an event:

MasterPage.ListView.ItemSelected += ListView_ItemSelected;

but I need to raise this event on the detail page itself so I can save data first.

Thanks

How to use ffmpeg to compress video in xamarin.fomrs

$
0
0

i want to compress and resize my video with ffmpeg, but i don't know how to use it...please help me.thanks

System.TypeInitializationException error when using NavigationPage

$
0
0

I'm on Xamarin.Forms version 2.3.2.127.

Anytime I seem to wrap my content pages in a NavigationPage I get the following error:

"System.TypeInitializationException: The type initializer for 'Attribute' threw an exception."

Even using something as simple will throwthe error, such as:
protected override void OnStart() { MainPage = new NavigationPage(new SimplePage()); }

Where simplePage is:

<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SimpleApp.SimplePage"> <Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" /> </ContentPage>

namespace SimpleApp { public partial class SimplePage : ContentPage { public test() { InitializeComponent(); } } }

Any help is appreciated, I'm not really sure how to proceed from here.


xamarin for beginners

$
0
0

Hey. I have experience for 3 years with with Swift, java and last year with React Native. Anyway I want to learn some Xamarin.forms.

What is your best resources for learning xamarin.forms?

Xamarin university is not a option...

Thank you for you possitive reply

M.

AppResources.Designer.cs is not re-generated after upgrade PCL -> NETSTANDARD 2.0

$
0
0

Finally I upgraded my App from PCL -> NETSTANDARD 2.0.
All went fine, app runs fine, it uses string resources fine.

Now I added a new string resource to AppResources.resx (with the VS built in grid resource editor), but the AppResources.Designer.cs is not re-generated, so I could not use the new string in my code:
error CS0117: 'AppResources' does not contain a definition for 'IDS_NEWSTRING'

Tried re-build, etc.

How to "ask" VS2017 (win)/Xamarin NETSTANDARD 2.0 to re-generate those AppResources.$LANG$.Designer.cs files?

Turn on location services without navigating to settings page?

Error on build app iOS, only on the production URL (https) :TrustFailure (One or more errors occu...

$
0
0

I have a problem when build my iOS project, only on the url production(for communication to web service). I think so wich the problem is the protocol HTTPS but i don't find any solution for this.My output:

P.S.: My HttpClient Implementation in iOS Build, is configured Managed(default)

System.Net.Http.HttpRequestException:

Thread finished: #10
The thread 0xa has exited with code 0 (0x0).
Thread finished: #11
The thread 0xb has exited with code 0 (0x0).
Thread finished: #6
The thread 0x6 has exited with code 0 (0x0).
2018-03-28 04:34:13.362 AppNivel.iOS[4830:44384]
Unhandled Exception:
System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (One or more errors occurred.) ---> System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Security.Interface.TlsException: CertificateUnknown
at Mono.AppleTls.AppleTlsContext.EvaluateTrust () [0x000ca] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:269
at Mono.AppleTls.AppleTlsContext.RequirePeerTrust () [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:210
at Mono.AppleTls.AppleTlsContext.ProcessHandshake () [0x00046] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System/Mon
o.AppleTls/AppleTlsContext.cs:186
at ...

at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at AppNivel.iOS.Application.Main (System.String[] args) [0x00001] in D:\AppNivel_Bkp_14032018_1450h\AppNivel\AppNivel.iOS\Main.cs:17
2018-03-28 04:34:13.366 AppNivel.iOS[4830:44384] Unhandled managed exception:
An error occurred while sending the request (System.Net.Http.HttpRequestException)
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x0046c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:406
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/msco
rlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at ...

2018-03-28 04:34:13.401 AppNivel.iOS[4830:44384] critical:

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries

used by your application.

The app has been terminated.

xamarin for beginners

$
0
0

Hey. I have experience for 3 years with with Swift, java and last year with React Native. Anyway I want to learn some Xamarin.forms.

What is your best resources for learning xamarin.forms?

Xamarin university is not a option...

Thank you for you possitive reply

M.

AppResources.Designer.cs is not re-generated after upgrade PCL -> NETSTANDARD 2.0

$
0
0

Finally I upgraded my App from PCL -> NETSTANDARD 2.0.
All went fine, app runs fine, it uses string resources fine.

Now I added a new string resource to AppResources.resx (with the VS built in grid resource editor), but the AppResources.Designer.cs is not re-generated, so I could not use the new string in my code:
error CS0117: 'AppResources' does not contain a definition for 'IDS_NEWSTRING'

Tried re-build, etc.

How to "ask" VS2017 (win)/Xamarin NETSTANDARD 2.0 to re-generate those AppResources.$LANG$.Designer.cs files?

create a view above the navigation & status Bar on Xamarin.Forms?

$
0
0

Hello World,

I tried to write a view on top of the screen with a RelativeLayout or ModalViews,
it wasn't working cause both doesn't include Navigation & Status Bar on their layout.

Do you know any implementation to displaying a view on top of all existed views?

Maybe I will have to create a blank view in natives environments, hope it will be possible to add it's content from PCL
Could you maybe guide me to start? Which class to extend in both environnement?

Thnaks by advance,


How to manage this decimal input?

$
0
0

here while input number then first it will add into decimal then it moved to left
How to create this?

System.IO.IOException: Sharing violation on path PropertyStore.forms

$
0
0

Hi,

On my android app, when i hit the home button or back button or try to take a picture with the Plugin.Media, i get the following error:
UNHANDLED EXCEPTION:
System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Sharing violation on path PropertyStore.forms
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0026d] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO/FileStream.cs:249
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO/FileStream.cs:149
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile isf) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs:127
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile isf) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs:142
at (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFileStream:.ctor (string,System.IO.FileMode,System.IO.IsolatedStorage.IsolatedStorageFile)
at System.IO.IsolatedStorage.IsolatedStorageFile.OpenFile (System.String path, System.IO.FileMode mode) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs:908
at (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFile:OpenFile (string,System.IO.FileMode)
at Xamarin.Forms.Platform.Android.Deserializer+<>c.b__1_0 () [0x00006] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Deserializer.cs:22
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x00012] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:680
at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502

i cant understat according to this callstack what is theorigion of the error,
but if some one had the same exception and found a solution i ll be happy to hear for a solution.

System.IO.IOException: Invalid handle to path "PropertyStore.forms"

$
0
0

Hi,
I have an Android App built with Xamarin.forms. Everyday, HockeyApp reports crashes with the exact same error:
System.IO.IOException: Invalid handle to path "PropertyStore.forms" at System.IO.FileStream..ctor(System.String_path__FileMode_mode__FileAccess_access__FileShare_share__Int32_bufferSize__Boolean_anonymous__FileOptions_options.args:1337) at System.IO.FileStream..ctor(System.String_path__FileMode_mode__FileAccess_access__FileShare_share__Int32_bufferSize__Boolean_isAsync__Boolean_anonymous.args:1337) at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(System.String_path__FileMode_mode__FileAccess_access__FileShare_share__Int32_bufferSize__System.IO.IsolatedStorage.IsolatedStorageFile_isf.args:1337) at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(System.String_path__FileMode_mode__System.IO.IsolatedStorage.IsolatedStorageFile_isf.args:1337) at com.algodesign.tagpunch.edStorage.IsolatedStorageFileStream:.ctor(string_System.IO.FileMode_System.IO.IsolatedStorage.IsolatedStorageFile.args:1337) at System.IO.IsolatedStorage.IsolatedStorageFile.OpenFile(System.String_path__FileMode_mode.args:1337) at com.algodesign.tagpunch.edStorage.IsolatedStorageFile:OpenFile(string_System.IO.FileMode.args:1337) at com.algodesign.tagpunch.Xamarin.Forms.Platform.Android.Deserializer+<>c.<DeserializePropertiesAsync>b__1_0(.args:1337) at System.Threading.Tasks.Task1[TResult].InnerInvoke(.args:1337) at System.Threading.Tasks.Task.Execute(.args:1337) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(.args:1337) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task_task.args:1337) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task_task.args:1337) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task_task.args:1337) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult(.args:1337) at com.algodesign.tagpunch.Xamarin.Forms.Application+<GetPropertiesAsync>d__66.MoveNext(.args:1337)

There is no explicit call to PropertyStore.forms or GetPropertiesAsync in the entire solution. Any idea how to fix or at least understand this issue? The App run on custom hardware with Kitkat 4.4.4.

Thanks for the help and have a nice day,
LP

Sharing violation on path PropertyStore.forms.tmp

$
0
0

I am seeing a huge upswing in reports of this in Insights in the past few days - seems to be mostly on Android, not iOS

the stack trace is

System.IO.FileStream.ctor(System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options)

System.IO.FileStream.ctor(System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous)

System.IO.IsolatedStorage.IsolatedStorageFileStream.ctor(System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile isf)

System.IO.IsolatedStorage.IsolatedStorageFileStream.ctor(System.String path, FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile isf)

System.IO.IsolatedStorage.IsolatedStorageFile.OpenFile(System.String path, FileMode mode)

Xamarin.Forms.Platform.Android.Deserializer+<>c__DisplayClass3.<SerializePropertiesAsync>b__2()

System.Threading.Tasks.Task.InnerInvoke()

System.Threading.Tasks.Task.Execute()

has anyone else run across this? Any suggestions on how to handle it?

Xamarin crash when calling external APIs

$
0
0

Here is my case (that I thought was simple and common).

MainPage.xaml.cs
private void Button_clicked(...) {
// Rely on backgound thread
MessagingCenter.Subscribe<SerialLoader, SerialRec>(this, "SerialLoader", OnSerialLoaded);
// Trigger the load
serialLoader.Load(targetID);
}

private void OnSerialLoaded(...) {
Device.BeginInvokeOnMainThread(() => Navigation.PushAsync(...));
}

SerialLoader.cs
public void Load(string targetID,) {
// API service call that "forces" me to use the following
client.LoadCompleted += OnSerialLoadCompleted(sender, e);
client.LoadAsync(...) // I don't think this call is "really async" as return type is void.
}

public void OnSerialLoadCompleted(object sender, LoadCompletedEventArgs e) {
if (...) { // If loaded successfully...
// Notify the receiver that load has completed.
MessagingCenter.Send<SerialLoader, SerialRec>(this, "SerialLoader", e.Result);
}
}

OnSerialLoaded is called successfully then Xamarin crashes the application with the following errors.

EMULATOR
Closes the application without any warning nor message!

SMARTPHONE (API 21)
03-29 18:47:52.617 E/mono-rt (13649): No native Android stacktrace (see debuggerd output).
03-29 18:47:52.617 E/mono-rt (13649):
03-29 18:47:52.617 E/mono-rt (13649):
03-29 18:47:52.617 E/mono-rt (13649): =================================================================
03-29 18:47:52.617 E/mono-rt (13649): Got a SIGSEGV while executing native code. This usually indicates
03-29 18:47:52.617 E/mono-rt (13649): a fatal error in the mono runtime or one of the native libraries
03-29 18:47:52.617 E/mono-rt (13649): used by your application.
03-29 18:47:52.617 E/mono-rt (13649): =================================================================
03-29 18:47:52.617 E/mono-rt (13649):
03-29 18:47:52.617 F/libc (13649): Fatal signal 11 (SIGSEGV), code 2, fault addr 0xbe562fd0 in tid 13649 (com.s4gv.mobile)

I assume this is related to executions on multiple threads; I had tried without MessagingCenter (see my question "Xamarin crashes when mixing Action and API calls (threading concern?)").

Also, I'm surprised both the emulator and the smartphone crash so badly!

Any help is appreciated as I'm now completely stuck :(

Additional details: VS2017 Community 15.6.4 on Windows 10 Xamarin Forms 2.5.0.280555 Target Android SDK 8.1 (API 27 - Oreo)

Viewing all 58056 articles
Browse latest View live


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