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

Navigation Toward TabbedPage App Breaks !

$
0
0
I have Primary Ordered Toolbar As Shown In Attached Image. The Next Page On Which I Want To Navigate Is Tabbed Page And Contain 3 Pages Inside That Tabbed Page Which Are References Through <local:someTabbedPage/>. When I Click Primary Toolbar Item The App Breaks.

How to Implement onClick Event of BadgeDrawable

$
0
0

I am using BadgeDrawable to show number of items in cart while implementing shopping cart App.
Following is the link to use this service. I have implemented this according to the description.

I want to add Onclick event of Badge so that on clicking Checkout Page should open. Anybody can please help me in doing the same.

Help with Close button out of frame

$
0
0

Hi.
I am trying to put the close button out of the frame.

That's the button, as you can see, it is inside the frame, but I want it out, on the top right corner.
My XAML:

<AbsoluteLayout HorizontalOptions="Center" VerticalOptions="FillAndExpand" BackgroundColor="Transparent" Padding="0,0,0,0">
        <Frame AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" BorderColor="Black" Padding="0" HorizontalOptions="Center" Margin="15" BackgroundColor="White" VerticalOptions="CenterAndExpand">
            <StackLayout Spacing="10" IsClippedToBounds="True" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                <Image Source="cerrar.png" WidthRequest="30" HorizontalOptions="End" TranslationX="1.9" TranslationY="-1.9" VerticalOptions="Start" Margin="0">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
                    </Image.GestureRecognizers>
                </Image>
                <StackLayout Padding="10,0,10,10" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
...

Thank you in advance :smile:

How to change xaml elements from page model

$
0
0

I have a Xamarin.Forms application using FreshMVVM. I need to change xaml of MyPage from MyPageModel. Specifically, MyPage has an empty container:

<AbsoluteLayout x:Name="Container" />

Its content is generated in MyPageModel and should be injected into the container from there. My question is this: is it possible to access the container from MyPageModel in a way similar to accessing it from the code-behind?

I realize that it may be against MVVM pattern's rules, yet I need it.

Here is a part of MyPageModel code:

public class VideoCallPageModel : BasePageModel
{
    SignalRService signalR;

    private XamarinLayoutManager _layoutManager = null;

...

public async override void Init(object initData)
{
    base.Init(initData);

    signalR = new SignalRService();
    ...
    signalR.OnIncomingCall += SignalR_IncomingCall;

...

private void SignalR_IncomingCall(object sender, VideoCallPeer peer)
{
    ...
   // This gives a null reference exception, as _layoutManager is not instantiated
    _layoutManager.AddRemoteView(remoteMedia.Id, videoChatView);
}

...

public class XamarinLayoutManager : LayoutManager<View>
{
  public AbsoluteLayout Container { get; private set; }

  public XamarinLayoutManager(AbsoluteLayout container)
    : this(container, null)
  { }

As you can see, _layoutManager is not set. To instantiate it, we need to pass to the constructor the AbsoluteLayout from our page.

how to make a loading tips?

$
0
0

If it is loading data how to display a loading tips?

How does one Cancel a subscription in In App Billing?

$
0
0

Hello,

I'm using this billing plugin: https://nugetmusthaves.com/Package/Plugin.InAppBilling
and the code is here: https://github.com/jamesmontemagno/InAppBillingPlugin

Developed by @JamesMontemagno

If anyone has good knowledge of that plugin/API, here's the dilemma...

My app is required to allow a user to cancel a subscription.
There does not seem to be any method to do so.

I do see a purchase.State property and PurchaseState.Canceled value but no further documentation or sample on actually canceling the subscription with the respective store from within the app. How to use the AutoRenewing property would be very useful too.

Can someone please point out how to CANCEL a subscription? And set a purchase to AutoRenew?

Further to that, I also see a PurchaseState.FreeTrial

My app has a 14 day trial period but I'm not using that state value.
Methinks using the PurchaseState.FreeTrial on a purchase to initiate/monitor the trial period would be better than what I've implemented NOT using the In App Billing API.

Is there any sample on how best to use that?

Thanks

How to assign text value to Grid column in C#

$
0
0

Hi,

In my XAML, I have this Grid layout:

   <Label Grid.Row="1"  Text="VendorID:" />
   <Label Grid.Column="1"  Grid.Row="1"  Text="" />

How do I fill-in the text for Column 1 from code-behind when use click a button? I'd like to assign Text = "0x046D" in column 1, row 1 of my Grid.

Appreciate any help.

How to find width of the text using length of the text in Entry field.

$
0
0

Hi,

How to find width of the text using length of the text in Entry field.


Unable to read HttpClient response in WPF app

$
0
0

I have a Forms app that works fine in iOS, Android and UWP. I have built WPF version using the instructions at
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/wpf
I am also using Forms 4.8.0.1269 and .Net fFramework 4.8
When I attempted to read data from a URL using HttpClient, I get an exception

Method 'SerializeToStreamAsync' in type 'System.Net.Http.ObjectContent' from assembly 'System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
There is no problem in the other platforms.

Does anyone know when Xamarin forms for support grpc.net.clinet?

$
0
0

I'm trying to create a cross-platform app that makes call to a web services passing images back and forth. Everything I have tried only seams to work with windows(UWP) and not with Android or IOS.

Find X,Y coordinates of image and place text in that position and save

$
0
0

Hi,
When I click an image, I need to get x,y position of that image and place a text in that position. Also need to save in the mobile.
I need to do it in Xamarin.Forms.
Please let me know how to do it with any sample.

Menu behaviour in xamarin list

$
0
0

Hello,
I want this menu behavior in my listview
Is it possible in xamarin or syncfusion?

Xamarin - Menu Hamburger - Java.Lang.NoSuchMethodError: 'no method with name='isAttachedToWindow' si

$
0
0

Desenvolvimento: **
Criei um App do zero, direcionei ele pra uma versão do android 4.2.2, o projeto abre normalmente.
**Problema Encontrado:

Ao implementar o menu Hamburger com a masterdatail e a detailpage o mesmo app quebra, retorna o seguinte erro: Java.Lang.NoSuchMethodError: 'no method with name='isAttachedToWindow' signature='()Z' in class Landroid/view/ViewGroup;'
Minha MainPage utliza esse trecho para definir a MasterDetail e a Detail:
this.Master = new Views.MasterMenu();
this.Detail = new NavigationPage(new Views.ListaMesas());
App.MasterDetail = this;
Curiosidade:
Quando rodo ele direcionado pra versão 5.0 em diante, funciona perfeitamente. O problema é que tenho alguns app's em clientes que usam tablets nesta versão 4.2.2 e a versão compilada em Nov/2019 funcionava perfeitamente, agora que precisei fazer uma atualização, não consigo rodar o app no tablet do cliente. Qualquer ajuda é bem vinda, caso haja algum pacote que me sirva pra carregar esse menu, ou uma maneira alternativa de ter esse menu, sem ser por masterdetail, também me serve.
Informações e configurações:
Versão Xamarim: 16.7.000.440
Versão Visual Studio: 16.7.2
Tablet Positivo - Android 4.2.2

C09XZY140477

ScrollView vertical scroll bar not visible on android

$
0
0

Environment: VS 2019, Xamarin Forms 4.6.0.1141 (and 4.8.0.1269)

a very simple case demonstrates the issue:

<?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="ScrollViewScrollBar.MainPage">

    <StackLayout>
        <ScrollView
            Orientation="Vertical" 
            VerticalScrollBarVisibility="Always"
            >
            <Editor Text="LeBron James has spent his career burdened ..."  [very long string]
                VerticalOptions="FillAndExpand"
                />
        </ScrollView>
    </StackLayout>

The vertical scroll bar is not displayed, even while scrolling. See screen shot

This appears to be a rather old unresolved issue:
[https://forums.xamarin.com/discussion/comment/389887]

Does anyone know of a workaround for this?

Thanks

Xamarin bindable properties Lottie animation

$
0
0

I am trying to achieve an animated check box, I have created boolean property.

It is working but when focus on page from other page, animation plays from begin to end.

My purpose is to play an animation till frames are set if value is true.

Thanks in advance.

Model

public  class WishListItem
{
    public string Art_code { get; set; }
    public string ImageUrl { get; set; }

    private bool _SendRequest;
    public bool SendRequest { get => _SendRequest; set { _SendRequest = value; RaisePropertyChanged(); } }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged([CallerMemberName] string propertyName = "")
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}

VM

public class WishList: INotifyPropertyChanged
{
    private ObservableCollection<WishListItem> _WishCount;

    public ObservableCollection<WishListItem> WishCount {
        get => _WishCount;
        set
        {
            _WishCount = value;
            RaisePropertyChanged();
        }
    }

    public WishList()
    {
        WishCount = new ObservableCollection<WishListItem>();
        WishCount = GetItems().Result;
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged([CallerMemberName] string propertyName = "")
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }

    public async Task<ObservableCollection<WishListItem>> GetItems()
    {
        foreach (var i in WishListService.WishListNew)
        {
            WishCount.Add(i); //Adding data 
        }

        return WishCount;
    }
}

Control

public class CustomCheckBox : AnimationView, IDisposable
{
    public string AnimationFile { get; set; }

    public CustomCheckBox()
    {
        Animation = "check.json";
        OnClick += Checkbox_OnClick;
    }

    public static BindableProperty IsCheckedProperty = BindableProperty.Create(
        nameof(IsChecked), typeof(bool), typeof(CustomCheckBox), defaultBindingMode: BindingMode.TwoWay,
        propertyChanged: IsCheckedChanged);

    public bool IsChecked
    {
        get { return (bool)GetValue(IsCheckedProperty); }
        set { SetValue(IsCheckedProperty, value); }
    }

    private static void IsCheckedChanged(BindableObject bindable, object oldValue, object newValue)
    {
        //   var cb = (CustomCheckBox)bindable;
        if (!(bindable is CustomCheckBox cb))
            return;

        if ((bool)newValue)
        {
            // cb.Play();
            cb.PlayFrameSegment(1, 50);
        }
        else
        {
            cb.PlayFrameSegment(1, 5);
            cb.IsPlaying = false;
        //    cb.Reset();
        }
    }

    void Reset()
    {
        Animation = null;
        Animation = AnimationFile;
    }

    void Checkbox_OnClick(object sender, EventArgs e)
    {
        IsChecked = !IsChecked;
    }

    public void Dispose()
    {
      OnClick -= Checkbox_OnClick;
    }
}

Xaml

<controls:CustomCheckBox x:Name="CustCheck" Grid.Row="0"  Grid.Column="1" VerticalOptions="End"                          
          IsChecked="{Binding SendRequest, Mode=TwoWay}" HeightRequest="35" WidthRequest="35" />

How can I put default location in map xamarin form?

$
0
0

I want to put default location(lat,long) when start my page.
I don't want to see moving map. I want to see only my default location starting from the first time.

OxyPlot Line Graph Not Showing!!!

$
0
0

Hiiiii

It used to work before and now no display for the line graph!!!!!!!

WHAT MIGHT HAVE HAPPENED???? PLEASE HELP

Loaded assembly: System.Runtime.CompilerServices.Unsafe.dll [External]
08-26 09:07:41.555 D/Mono (25472): Requesting loading reference 4 (of 7) of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/CompuChemApp.dll
08-26 09:07:41.555 D/Mono (25472): Loading reference 4 of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/CompuChemApp.dll asmctx DEFAULT, looking for OxyPlot, Version=2.0.0.0, Culture=neutral, PublicKeyToken=638079a8f0bd61e9
08-26 09:07:41.555 D/Mono (25472): Assembly Ref addref CompuChemApp[0xf0d7e5c0] -> OxyPlot[0xf0d7f700]: 4
08-26 09:07:41.609 I/Choreographer(25472): Skipped 34 frames! The application may be doing too much work on its main thread.
08-26 09:07:41.876 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:41.905 I/OpenGLRenderer(25472): Davey! duration=791ms; Flags=1, IntendedVsync=40574908270446, Vsync=40575474937090, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=40575489354970, AnimationStart=40575489423660, PerformTraversalsStart=40575489709860, DrawStart=40575671755420, SyncQueued=40575674758340, SyncStart=40575760371760, IssueDrawCommandsStart=40575761820130, SwapBuffers=40575767255940, FrameCompleted=40575785348850, DequeueBufferDuration=519000, QueueBufferDuration=770000,
08-26 09:07:41.909 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:41.973 I/OpenGLRenderer(25472): Davey! duration=942ms; Flags=1, IntendedVsync=40574908270446, Vsync=40575474937090, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=40575489354970, AnimationStart=40575489423660, PerformTraversalsStart=40575489709860, DrawStart=40575786845770, SyncQueued=40575787481330, SyncStart=40575789523020, IssueDrawCommandsStart=40575789677760, SwapBuffers=40575795856900, FrameCompleted=40575852790010, DequeueBufferDuration=630000, QueueBufferDuration=27470000,
08-26 09:07:42.020 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:42.162 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:43.240 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:50.007 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:50.008 D/OpenGLRenderer(25472): endAllActiveAnimators on 0xb7138700 (RippleDrawable) with handle 0xb70ea780
08-26 09:07:50.187 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:54.999 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:55.060 D/Mono (25472): Requesting loading reference 6 (of 8) of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Forms.Platform.Android.dll
08-26 09:07:55.061 D/Mono (25472): Loading reference 6 of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Forms.Platform.Android.dll asmctx DEFAULT, looking for Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
08-26 09:07:55.061 D/Mono (25472): Assembly Ref addref OxyPlot.Xamarin.Forms.Platform.Android[0xe5b2f840] -> Mono.Android[0xe5b7d440]: 54
08-26 09:07:55.061 D/Mono (25472): Requesting loading reference 5 (of 8) of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Forms.Platform.Android.dll
08-26 09:07:55.061 D/Mono (25472): Loading reference 5 of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Forms.Platform.Android.dll asmctx DEFAULT, looking for OxyPlot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=638079a8f0bd61e9
08-26 09:07:55.061 D/Mono (25472): Assembly Loader probing location: '/storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.dll'.
08-26 09:07:55.062 D/Mono (25472): Assembly Ref addref OxyPlot.Xamarin.Forms.Platform.Android[0xe5b2f840] -> OxyPlot[0xf0d7f700]: 5
08-26 09:07:55.062 D/Mono (25472): Requesting loading reference 7 (of 8) of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Forms.Platform.Android.dll
08-26 09:07:55.062 D/Mono (25472): Loading reference 7 of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Forms.Platform.Android.dll asmctx DEFAULT, looking for Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
08-26 09:07:55.062 D/Mono (25472): Assembly Ref addref OxyPlot.Xamarin.Forms.Platform.Android[0xe5b2f840] -> Xamarin.Forms.Core[0xe5b7cea0]: 12
08-26 09:07:55.138 D/Mono (25472): Requesting loading reference 2 (of 4) of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Android.dll
08-26 09:07:55.138 D/Mono (25472): Loading reference 2 of /storage/emulated/0/Android/data/com.mykpaonline.mykpaonsite/files/.override/OxyPlot.Xamarin.Android.dll asmctx DEFAULT, looking for System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
08-26 09:07:55.138 D/Mono (25472): Assembly Ref addref OxyPlot.Xamarin.Android[0xf0d7f6a0] -> System.Core[0xe5b7e220]: 7
08-26 09:07:55.200 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:56.365 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:58.576 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)
08-26 09:07:58.578 D/OpenGLRenderer(25472): endAllActiveAnimators on 0xb71a4a80 (RippleDrawable) with handle 0xb70ea7d0
08-26 09:07:58.668 D/EGL_emulation(25472): eglMakeCurrent: 0xda63e060: ver 3 0 (tinfo 0xbe683390)

App crashes when user denies the scanning QR code permission

$
0
0

Hi I am using ZXing.Net.Mobile (2.4.1) for scanning QR code. when user click on scan button and accept the permission then app works fine.
If user clicks on deny the App crashes /Exception:"System.UnauthorizedAccessException: ZXing.Net.Mobile requires: android.permission.CAMERA, but was not found in your AndroidManifest.xml file.

I am using below code in MainActivity.cs
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
ZXing.Net.Mobile.Android.PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults);

    }

Can anyone help me with this

Blank app when build Android Release

$
0
0

Android app show blank screen when I build release version.
Everything is ok when run debug.
I use Visual studio 2019 16.7.2, Xamarin.form 4.8.0.1269
Can you help me.
Thank you.

Shapes not working in Xamarin ShellContent

$
0
0








In Itemspage I have a below Shape

Shape is appearing only for first time on that page, if I navigate to other Tab and come back to Browse Tab Shapes are not visible.

Viewing all 79144 articles
Browse latest View live


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