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

OCR library for Xamarin.Forms

$
0
0

Hi all,

I was wondering if someone has found a way to implement OCR in a Xamarin.Forms app to be distributed to iOS, Android and Windows Phone 8.
This is my Research so far, but I will require to expend $400:

Has someone found an open source API for Xamarin iOS and Android?
Is there a PCL already created for this?

Thank you so much for your time.

Regards


Can't catch exceptions from HttpWebRequest after Xamarin update

$
0
0

Hi,

I recently updated everything in my Visual Studio Mac installation. I still use Xamarin Forms 3.1 though.

After this update, I have got a lot of crashes from Android users (I haven't released the iOS version yet) and it seems to be related to HttpWebRequest. I use it in the following way:

        WebRequest req = HttpWebRequest.CreateDefault(new Uri(url));
        req.Timeout = TimeoutMilis;
        ...
        using (Stream dataStream = req.GetRequestStream())
        {
            dataStream.Write(data, 0, data.Length);
        }

I have a try catch around it, but it seems like these errors are not caught. The stack traces I get are not very helpful either:

        android.runtime.JavaProxyThrowable: System.AggregateException: A Tasks exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.Net.WebException: The request was aborted: The request was canceled. 

        caused.AggregateException(s)
        System.Net.HttpWebRequest.<MyGetResponseAsync>d__243.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        --- End of inner exception stack trace ---
        ---> (Inner Exception #0) System.Net.WebException: The request was aborted: The request was canceled.
        System.Net.HttpWebRequest.<MyGetResponseAsync>d__243.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0

Another similar crash:

         android.runtime.JavaProxyThrowable: System.AggregateException: A Tasks exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.ObjectDisposedException: Cannot access a disposed object. 

        caused.AggregateException(s)
        Object name: 'System.Net.Sockets.Socket'.
        System.Net.Sockets.Socket.ThrowIfDisposedAndClosed()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.Sockets.SocketTaskExtensions.<>c.<ConnectAsync>b__2_1(IAsyncResult asyncResult)<1430f9cebba746309b69090b6cda9ce8>:0
        System.Threading.Tasks.TaskFactory<TResult>.FromAsyncCoreLogic(IAsyncResult iar, Func<T, TResult> endFunction, Action<T> endAction, Task<TResult> promise, bool requiresSynchronization)<e7c4dd6cd0ad467d9712102a6791959b>:0
        System.Net.WebConnection.<Connect>d__16.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebConnection.<InitConnection>d__19.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebOperation.<Run>d__57.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebCompletionSource<T>.<WaitForCompletion>d__15.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebOperation.<GetRequestStream>d__49.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        --- End of inner exception stack trace ---
        ---> (Inner Exception #0) System.ObjectDisposedException: Cannot access a disposed object.
        Object name: 'System.Net.Sockets.Socket'.
        System.Net.Sockets.Socket.ThrowIfDisposedAndClosed()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.Sockets.SocketTaskExtensions.<>c.<ConnectAsync>b__2_1(IAsyncResult asyncResult)<1430f9cebba746309b69090b6cda9ce8>:0
        System.Threading.Tasks.TaskFactory<TResult>.FromAsyncCoreLogic(IAsyncResult iar, Func<T, TResult> endFunction, Action<T> endAction, Task<TResult> promise, bool requiresSynchronization)<e7c4dd6cd0ad467d9712102a6791959b>:0
        System.Net.WebConnection.<Connect>d__16.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebConnection.<InitConnection>d__19.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebOperation.<Run>d__57.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebCompletionSource<T>.<WaitForCompletion>d__15.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0
        System.Net.WebOperation.<GetRequestStream>d__49.MoveNext()<1430f9cebba746309b69090b6cda9ce8>:0

Has anyone had a similar problem?

Xamarin Forms - FontAwesome works iOS,Android but UWP display [x]

$
0
0

Hello dear Xamariners !

I'm wasting a lot of time trying to figure out why FontAwesome doesn't work on Android & iOS.
No need to tell you that I've tried several solutions I found on this forum.

To help you to help me (what ? haha)
Here are some screenshots :

On iOS :

On UWP or Android (kind of same result I don't have the right icon)

The FontFamily resource in app.xaml :

My Fonts folder :

My VS fonts Android folder with the properties AndroidAsset // copy if newer

My VS fonts UWP folder with the properties Content // Do not copy

Do you have any idea why it isn't working ?

I've tried several way to declare my font (without the otf.#name of font , with .otf#name of font style , with .otf only)

If anybody got this working, it would be awesome :) to get some help.
PS : I'd like to avoid a custom renderer

I wish you all a good weekend !

Integrating with SiriKit problems

$
0
0

I'm working as per this guide
https://docs.microsoft.com/en-us/xamarin/ios/platform/sirikit/implementing-sirikit?tabs=macos

Everything is good up until step #5 which is adding the new Xamarin.iOS library as a reference to my .Net Standard 2.0 main project. But I could not add it because of an (Incompatible target framework. Xamarin.iOS version=v1.0) error.

@JoeManke advised me to add the iOS library to the iOS project and then use it through dependency injection within the main project. However as I implemented this workaround and moved forward to step #6 I found that all models that will be moved to the new library will be under an unaccessible namespace to the shared project where all the work is being done.

Object reference null

$
0
0

using xamarin.forms
vs2017
.....
Page open normally
when i back to page before
this exception happen
why ???????????


at Syncfusion.ListView.XForms.iOS.ExtendedScrollViewRenderer.Dispose (System.Boolean disposing) [0x00009] in :0
at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildRemoved (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:122
at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00092] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:200
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0005c] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:73
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:331 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:331
at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:331 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.ScrollViewRenderer.Dispose (System.Boolean disposing) [0x00016] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ScrollViewRenderer.cs:165 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:331
at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:331 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.DisposeHelpers.DisposeModalAndChildRenderers (Xamarin.Forms.Element view) [0x00038] in D:\a\1\s\Xamarin.Forms.Platform.iOS\DisposeHelpers.cs:17 at Xamarin.Forms.Platform.iOS.Platform.HandleChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00006] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:297 at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:617 at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x0001f] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:357 at Xamarin.Forms.VisualElement.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:748 at Xamarin.Forms.Page.OnInternalRemoved (Xamarin.Forms.VisualElement view) [0x00013] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:380 at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00022] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:358 at System.Collections.ObjectModel.ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288
at System.Collections.ObjectModel.ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:351 at System.Collections.ObjectModel.ObservableCollection1[T].RemoveItem (System.Int32 index) [0x0002b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:205
at System.Collections.ObjectModel.Collection1[T].Remove (T item) [0x00027] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:113 at Xamarin.Forms.NavigationPage+<Xamarin-Forms-INavigationPageController-RemoveAsyncInner>d__69.MoveNext () [0x000e8] in D:\a\1\s\Xamarin.Forms.Core\NavigationPage.cs:304 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
at Xamarin.Forms.Platform.iOS.NavigationRenderer+d__75.MoveNext () [0x00062] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:725
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at Xamarin.Forms.Platform.iOS.NavigationRenderer+ParentingViewController+d__41.MoveNext () [0x0003a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:1235
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.1.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at ALOROUBAH.iOS.Application.Main (System.String[] args) [0x00001] in E:\Mob Applications\ALOROUBAH\ALOROUBAH\ALOROUBAH.iOS\Main.cs:17

How to send file with HttpClient post in xamarin forms

$
0
0

I want to send file through post request using httpclient this what i tried but file didn't sent , when i tried in postman it works fine

string Url = $"http://ataprojects.net/test/products.php?request_type=add&company_name={BaseService.Company}&name={product.name}&barcode={product.barcode}&buy_price={product.buy_price}&sell_price={product.sell_price}";
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    var content = new MultipartFormDataContent();
                    content.Headers.ContentType.MediaType = "multipart/form-data";
                    content.Add(new StreamContent(product._mediaFile.GetStream()),
                      "image",
                       product.image);                    
                    var response = client.PostAsync(Url, content).Result;

                    response.EnsureSuccessStatusCode();
                    if (response.IsSuccessStatusCode)
                    {
                        var contentdata = await response.Content.ReadAsStringAsync();                       
                        var Items = JsonConvert.DeserializeObject<AddProductReturnModel>(contentdata);
                        return Items;
                    }
                    else
                    {
                        return null;
                    }
                }

            }

what's the problem ?

Can't use Navigation.PushAsync with existing page

$
0
0

Hello!
I have several pages to create certain UI elements (it's more complicated than just clicking a button and adding something to existing UI)
The code (in async void):
switch (Convert.ToString(await DisplayActionSheet("Element to add", "Cancel", "", "Prologue", "First Option", "Option", "Text", "Epilogue"))) { case "Prologue": await Navigation.PushAsync(new NewPrologue()); break; case "First Option": await Navigation.PushAsync(new NewOption()); break; case "Option": await Navigation.PushAsync(new NewOption()); break; case "Text": await Navigation.PushAsync(new NewText()); break; case "Epilogue": await Navigation.PushAsync(new NewEpilogue()); break; default: break; }
and pages:

However, Visual Studio doesn't recognize anything besides NewPrologue (throws error CS0246 with name "NewOption" etc. [I don't have English version of VS])

I'm using Xamarin in Visual Studio 2017 on Windows 10 and Xamarin.Essentials
How's that possible and how to solve this problem?

If you have any questions, feel free to ask

Is there a way to only invisible of ListView.ItemTemplate and keep ListView.Header ?

$
0
0

I find IsVisible attribute only in the itself but don't find in neither <ListView.ItemTemplate> nor <ListView.Header>, So is there a way to only invisible <ListView.ItemTemplate> and keep <ListView.Header> visible?


Any work-around for the slow Entry focus behaviour after calling MobileAds.Configure

$
0
0

I have a repro of a problem where if I add one line of innocuous code then the focus for the Entry field is very slow. Stranger still, if one switches to another app and back then the slow focus problem disappears.

Any suggested work-arounds?

Thanks in advance and details of the repro follow below:

Focus on Xamarin.Forms.Entry is slow when calling Google.MobileAds.MobileAds.Configure from Xamarin.Google.iOS.MobileAds.

Prerequisites:

  1. Valid GoogleAdMob publisher id
  2. Physical iOS device (the problem is not exposed with the simulator)

Repro Steps:

  1. Create a new Xamarin.Forms Shared application that includes iOS.
  2. In the default generated App() constructor add three Entry controls to the layout.

So that the constructor is now:

public App()
{
    // The root page of your application
    var content = new ContentPage
    {
        Title = "EntryTest1",
        Content = new StackLayout
        {
            VerticalOptions = LayoutOptions.Center,
            Children = {
                ///////////////
                /// Add three Entry Controls
                new Entry(),
                new Entry(),
                new Entry(),
                ///////////////
                new Label {
                    HorizontalTextAlignment = TextAlignment.Center,
                    Text = "Welcome to Xamarin Forms!"
                }
            }
        }
    };

    MainPage = new NavigationPage(content);
}
  1. Add the package Xamarin.Google.iOS.MobileAds and ensure packages are up-to-date
  2. Build and Run the application on the device
  3. OBSERVE: the caret of the Entry control quickly appearing indicates that the Entry control has focus as one selects Entry control after Entry control

*** Now add one line of code that will cause a second delay for the Entry control to receive focus.

  1. In the AppDelegate.cs file of the iOS project add:

Google.MobileAds.MobileAds.Configure("ca-app-pub-YOUR~PUBID");

to method:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)

  1. Build and Run the application on the device
  2. OBSERVE: the caret of the Entry control is slow to appear (is unresponsive for one second) as one selects Entry control after Entry control

*** Now switching to another application will improve the responsiveness to normal

  1. While the application with the slow responsive test app is running switch to another application (such as safari).
  2. Switch back to the test application
  3. OBSERVE: The caret quickly moves to the Entry control that is being selected. The unresponsive problem is gone.

What would cause the TabbedPage to show a drop-down selection?

$
0
0

I have a Shared Xamarin Forms app where I use compile directives to show ads.

I have two android projects (one with ads and one without) where I make heavy use of linked files to share code.

I am surprised that the app without ads is showing tabbed spaced across the top where the app with ads is showing a drop-down selection for the different tabs. See the attached images to see how this is represented on the same emulator.

Before I start the time-grinding isolation effort I want to get some thoughts on what could be causing this behavior. FYI - the image sizes for launcher are both 72x72 and I "fingerprinted" them to know that they are both coming from drawable-hdpi

Thanks for your time, Paul

Get LayoutBound of custom control in ListView

$
0
0

I have control MoreOption (use SkiaSharp draw ). I use it at ListView . Every row of ListView have 1 MoreOption . When i clicked, it show popup (Update, Delete) . I use TapGestureRecognizer_Tapped to get position at row has chosen , but I can't get it's position .
Result : i want show popup at MoreOption's position when i clicked.

Here's code:
Inside ListView.xaml :

  <ViewCell>
      <AbsoluteLayout>
          <Label Text="{Binding ID , StringFormat='{0:D3}'}"  AbsoluteLayout.LayoutBounds="0,0.5,0.75,1"
                                    VerticalTextAlignment="Center" 
                                    FontAttributes="Bold" AbsoluteLayout.LayoutFlags="All"/>
          <Label Text="{Binding FullName}"                        
                                    VerticalTextAlignment="Center"  AbsoluteLayout.LayoutBounds="0.4,0.5,0.75,2" AbsoluteLayout.LayoutFlags="All"
                                    FontAttributes="Bold" FontSize="20"
                                    TextColor="{Binding Number, Converter={StaticResource ColorConverter}}"/>
           <controls:MoreOption AbsoluteLayout.LayoutBounds="1.82,-0.5,0.5,1.5" AbsoluteLayout.LayoutFlags="All" />
       </AbsoluteLayout>
   </ViewCell>~~~~

Inside MoreOption.xaml :

     <AbsoluteLayout VerticalOptions="FillAndExpand" x:Name="MoreOptionBtn">
        <AbsoluteLayout.GestureRecognizers>
            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </AbsoluteLayout.GestureRecognizers>
        <skia:SKCanvasView x:Name="canvasView" AbsoluteLayout.LayoutBounds="0,0,0.1,0.15"
                        PaintSurface="OnCanvasViewPaintSurface"
                        AbsoluteLayout.LayoutFlags="All"/>

        <skia:SKCanvasView x:Name="canvasView1" AbsoluteLayout.LayoutBounds="0,0.075,0.1,0.15"
                        PaintSurface="OnCanvasViewPaintSurface"
                        AbsoluteLayout.LayoutFlags="All" />

        <skia:SKCanvasView x:Name="canvasView2" AbsoluteLayout.LayoutBounds="0,0.15,0.1,0.15"
                        PaintSurface="OnCanvasViewPaintSurface"
                        AbsoluteLayout.LayoutFlags="All" />
    </AbsoluteLayout>

Inside MoreOption.cs :
private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e,TapGestureRecognizer tapGesture)
{
//var a = (AbsoluteLayout)sender;
//Page.DisplayAlert("Alert !!!", a.Bounds.X + "," + a.Bounds.Y+"****"+a.Bounds.Location, "OK");
ProgressDialog.ShowPopup(Page.Content, new MenuMoreOptions());
}

Have any way resolve this issue ???

Xamarin.froms Android Window background visible while choosing image in gallery in Android

$
0
0

Xamarin.froms Android Window background visible while choosing image in gallery in Android

Pixel off in application for battery saving

$
0
0
Hi all. I want to add black theme in my application that doesn't use pixels at background. I can set black color to background but I don't sure that amoled screen will turn off those pixels.
How to create theme that turns off pixels?

Webview Navigating event not working

$
0
0

I have created a webview renderer in android, where I've made POST calls.
In portable project webview's navigating event has stopped working, Navigated event is working fine.
If I remove renderer than navigating event is working fine.

How to save audio file after recording voice in Xamarin.Forms

$
0
0

I am wondering how to save an audio file in Xamarin forms. I can get the location where to save to AppDataDirectory using Xamarin.Essentials:

var mainDir = FileSystem.AppDataDirectory;

But I am not sure how to save it in code, right after recording it using the NateRickard AudioRecorder Plugin:

var recordTask = await recorder.StartRecording();
var audioFile = await recordTastk;

Its same as saving/creating any binary file in C#? Say its same as saving an image file? And additionally do I need to use Dependency Injection to save it using platform specific code, or I can manage to only do it from the PCL code?


How to set background color for xamarin forms android splash screen?

$
0
0

Following is the splash screen code of my xamarin forms android:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <bitmap
        android:gravity="fill_horizontal|fill_vertical"
        android:src="@drawable/splashbg"/>
    </item>
    <item>
        <bitmap
        android:src="@drawable/icon"
        android:tileMode="disabled"
        android:gravity="center"/>
    </item>
</layer-list>

I wanna remove the first bitmap(named splashbg) and provide a background color for the entire page. How to give background color in xamarin android? Currently showing black color.

Try adding android:color="#00aff0" for layer list, but not working...

Show/hide navigation bar

$
0
0

Hello developers,

It is possible when ScrollView is scrolling then navigation bar show and hide in xamarin forms(PCL).

Thanks

Deepak

Checkbox with Xamarin.Forms

$
0
0

Hi everyone, I have been using Checkbox from Xlabs for a long time but I'm having trouble with it, since I can't change the color of the checked box.
The problem is that this color is almost the same as the color of selected row in ListView (and I can't change that either).

I have tried using the InputKit library, but can't install it from nuget, since it doesn't target my PCL profile.
Is there any simple checkbox implementation out there that is worth using?

Xamarin.Forms MacOS MasterDetailPage issues

$
0
0

When changing the detail page from the masterview, the app will crash when set de Detail on the MasterDetail page.
What is the best solution to change from menu-items and set it to a new navigationpage?

Can I change back button icon to something else?

$
0
0

Hey guys, so like the title says, is it possible to change the Navigation bar back button icon to something else. I wanted to change the back button in certain pages, replacing it with a home image icon. Tried several methods, none of which worked. I want to do this in Android and IOS

Thanks in advance!

Viewing all 81910 articles
Browse latest View live


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