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

Error MT2002

$
0
0

Xamarin Forms project, visual studio 2017 15.9.4. I compile a project with connection to macbook.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3): error MT2002: Can not resolve reference: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Resources.Reader.dll


How to send push notification to watch app for Xamarin form app that is installed in paired phone

$
0
0

hi all,
I have a xamarin form (Shared project)Application which is installed in an iphone device. Now my requirement is to create a watch app and that watch app should be able to receive notification from the phone app. So my questions are :
1. How to connect the xamarin form iphone app to the watch app.
2. How to send notification from that iphone app to the watch app.
3. how to display notification in the watch app.

Thanks in advance.

Showing DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT when loading a page

$
0
0

Redirecting to App.g.i.cs when loading a page in xamarin UWP. Code control comes to the following if block.

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
        UnhandledException += (sender, e) =>
        {
            if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
        };
#endif

If I mouse over the e showing {Windows.UI.Xaml.UnhandledExceptionEventArgs}

I am not understanding what is the problem? Is this related to some error in XAML? This issue is only on the windows app, Android and IOS apps parts are working fine.

Thanks in advance :)

How to control the keyboard download event in iOS

$
0
0

I have a form in Xamarin with two (entry controls) one of them, when doing Tap it opens a modal window that contains a list and the other has a normal operation, everything works well until the user opens the normal Entry keyboard first and then call the modal, when this happens the keyboard is up and the list is shown blocking the view of the user as follows...

I would like to change this behavior, so I attach the XAML code of the view

MyView.XAML:

<Entry             
            Placeholder="Nombre Sustancia Química"
            Margin="15,5,15,5"
            HorizontalOptions="FillAndExpand"
            Text="{Binding NombreSustancia, Mode=TwoWay}"
            IsEnabled="{Binding EntryEnabled}">
        </Entry>


       <Entry    
            x:Name="Make"
            Placeholder="Seleccione Fabricante"
            Margin="15,5,15,5"
            Focused="Entry_Focused"
            HorizontalOptions="FillAndExpand"
            Text="{Binding NombreFabricante, Mode=TwoWay}"
            IsEnabled="{Binding EntryEnabled}">
       </Entry>

MyView.XAML.CS:

public partial class FiltrosSisquimView : ContentPage
    {
        public ObservableCollection<Fabricante> Fabricantes { get; set; }


        public FiltrosSisquimView ()
        {              
            InitializeComponent();            
        }

        private async void Entry_Focused(object sender, FocusEventArgs e)
        {
            //prevents the keyboard from opening when calling the modal
            Make.Unfocus();          
            var mainViewModel = MainViewModel.GetInstance();
            Fabricantes = mainViewModel.Filtros.Fabricantes;
            mainViewModel.FabricantesModal = new FabricantesModalViewModel(Fabricantes);
            await Application.Current.MainPage.Navigation.PushModalAsync(new FabricantesModalView());
        }      

    }

I must say, that this problem only happens in iOS, and that Android has the expected behavior (when opening the modal the keyboard is automatically lowered), how could the keyboard go down when the user has already opened the list? Where should I control this event? on the modal page? in the codebehind? I am occupying MVVM as architectural pattern

any help for me?

Hamburger menu Xamarin.Forms (especially for Android + iOS).

$
0
0

Good day!
I'm sorry for disturbing you.
Im new in Xamarin Forms and im trying to build a app which has hamburger menu like this...
Sorry but can not add screenshots ((
I found this in the Internet, but this is not the case and I could not add it

How can I add this correctly, please can u something advise or help with this?
Thank you in advance!

Can I Unsubscribe a MessagingCenter multiple times?

$
0
0

In my application I am Subscribing the MessagingCenter from Page 1 and the data received from Page2,so how to unsubcsribe the messaging center(which already subscribed from page 1) when user press hardware backbutton without sending any values?

Deployment failed. Architecture not supported.

$
0
0

Hi

I am getting the below error while deploying..

The package does not support the device architecture (x86). You can change the supported architectures in the Android Build section of the Project Options.

Deployment failed. Architecture not supported.

How to work 2 projects in 1 solution?

$
0
0

I can navigate 2nd project?? and how do ?


jarsigner error java.lang.runtimeexception keystore load keystore was tampered with, or password wa

$
0
0

Getting the title error when publishing android APK in Xamarin Forms. I am trying to do this from Mac visual studio.

Screenshot:

I am sure my password is correct. Is there any other reason for this issue? What is keystore tampering?

Please help me.

How to solve the below issue which i am getting while writing UI tests

$
0
0

This is a simple UI test which I have created for a Xamarin.Forms application and I am getting this error while running tests.

Let me know how to solve this issue.

Get the selected entry to only update this when serial scanning

$
0
0

Hello,

I have been working with scanner devices, only using keyboard interfaces and i had no problems, because you only have to select the entry where you want to "paste" the value of the scanned barcode, and scan. Nothing more, the scanned value actually updates the entry value where you are pointing to.

But now that i have to use the serial interface to use COM ports, and i have a problem.

What i have succesfully done since now is:

1- open the serial port where my barcode scanner device is connected,

`{
serialPort = new SerialPort();

        Close();

        serialPort.PortName = portName;
        serialPort.BaudRate = baudRate;
        serialPort.Parity = parity;
        serialPort.DataBits = dataBits;
        serialPort.StopBits = stopBits;

        // Set the read/write timeouts
        serialPort.ReadTimeout = 500;
        serialPort.WriteTimeout = 500;

        serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

        try
        {

            serialPort.Open();
            this.IsOpen = true;
        }
        catch (Exception e)
        {
            throw new Exception(e.Message);
        }

        return true;
    }`

2- Listen to the scan event and update the value of the "ScannedText" variable (located in BaseViewModel.cs) to show the barcode value on the xaml:

`private void DataReceivedHandler(object sender, EventArgs e) //SerialDataReceivedEventArgs
    {
        SerialPort sp = (SerialPort)sender;
        text = sp.ReadExisting();

        //Send the value to the ViewModel
        BaseViewModel.Current.ScannedText = text;
    }`

Xaml:

<Entry x:Name="BarcodeEntry" Text="{Binding ScannedText, Source={x:Static base:BaseViewModel.Current}}"

THIS WORKS, the value of the scanned barcode is printed on the xaml entries where the binding variable is the "ScannedText" variable.

But what if i have more than one entry on my page and i want to update ONLY the entry value where i'm actually pointing, and do nothing to the other one? I guess i don't should use variables for this and send the entry to the event, but don't know how. I'm really stucked.

Thanks!

Inconstant behavior with different phones with VideoView

$
0
0

Hey everyone.

I've recently picked up Xamarin Forms to make a stream player app, but I've come across a problem that I can't seem to solve.
My problems are related to making implementing a video view within my app (Android specifically, I'm not focusing on iPhone at the moment).

The result I'm wanting to achieve is having a videoview together with webview taking 40% and 60% of vertical screen space respectively. While if the phone is rotated horizontally, filling the whole screen with only videoview taking all screen.

Basically what I'm trying to do is define my view as a grid with two rows and place a videoview and webview inside like this:
`

        <Grid.RowDefinitions>
            <RowDefinition Height="40*" />
            <RowDefinition Height="60*" />
        </Grid.RowDefinitions>

        <controls:VideoPlayer
            VerticalOptions="StartAndExpand"
            HorizontalOptions="StartAndExpand"
            Grid.Row="0"
            AutoPlay="True"
            Source="{Binding StreamUrl, Mode=OneWay}" />

        <WebView
            Grid.Row="1"
            Source="{Binding HtmlSource, Mode=OneWay}" />
    </Grid>

`

The implementation of VideoView on Android follows the Microsofts' guide: docs.microsoft[dot]com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/video-player/, with the exception of the VideoView being put in RelativeLayout with there paramaters:

LayoutRules.AlignParentLeft, LayoutRules.AlignParentRight, LayoutRules.AlignParentBottom, LayoutRules.AlignParentTop,
as I want it to fill the whole screen space rather than being centered/match aspect ratio.

And the way I currently handle the rotation of screen to resize the elements:

    `protected override void OnSizeAllocated( double width, double height )
    {
        base.OnSizeAllocated( width, height );

        if( width > height ) {
            // Rotated horizontally
            gridLayout.RowDefinitions[ 0 ].Height = new GridLength( 100, GridUnitType.Star );
            gridLayout.RowDefinitions[ 1 ].Height = new GridLength( 0, GridUnitType.Absolute );
        }
        else {
            // Rotated vertically
            gridLayout.RowDefinitions[ 0 ].Height = new GridLength( 40, GridUnitType.Star );
            gridLayout.RowDefinitions[ 1 ].Height = new GridLength( 60, GridUnitType.Star );
        }
    }`

When deploying on the android emulator which is running Android 8.1.2 or two of my phones where one is running 8.0.0 and 7.1.2 it produces the expected behaviour, but when deploying on my LG G4, which is running 6.0 when rotating the phone from vertical to horizontal the videoview will not fill the whole screen, but rather the same space as on vertical and afterwards, if phone is rotated again to vertical, it will zoom into the left corner of the videoview.

Here are screenshots of what is happening:
1) View is positioned vertically:
us.v-cdn[dot]net/5019960/uploads/editor/d1/92pnge4sgzxi.png

2) Rotated horizontally:
us.v-cdn[dot]net/5019960/uploads/editor/0y/zcc9k9pqlgbz.png

3) Rotated vertically again:
us.v-cdn[dot]net/5019960/uploads/editor/5e/pustgdj7hauz.png

As you can see, initially if fills the whole space, but once rotated horizontally it will not fill anymore either vertically or horizontally and if the screen is rotated once again, the vertical view is now zoomed in to the left side.

I've been looking into this issue and it seems to be affecting other people as well (coincidencally with the exact same phone), as described in this Github issue: github[dot]com/martijn00/XamarinMediaManager/issues/233

Since the first instinct with something like this is to blame your code so I went ahead and tried some of the available implementations on Github. One of these was github[dot]com/adamfisher/Xamarin.Forms.VideoPlayer which produced the exact same broken behaviour.

Afterwards I gave a go with the ExoPlayer implementation (much appreciation for everyone that made bindings for it) here: github[dot]com/martijn00/ExoPlayerXamarin and while it actually resized the videoview when rotating the screen I can't seem to make it fill the whole parent, where it rather keeps it in centrer and ignores Verical/HorizontalOptions of "StartAndExpand". The first implementation of VideoView (Microsofts') seem to also work properly when I specify the RelativeLayout paramaters as CenterInParent, but unfortunately that is not the effect I want to achieve.

In the end I tried to switch to RelativeLayout to see if it solved my issue, and unfortunately it produces the same effect.

So I'd wondered whether anyone else has had similar issues and if someone could help me solve this issue of getting VideoView to fit the whole allocated space and resizing properly when rotating the screen on all android devices. Or maybe point out the issues in my way of trying to resize the videoview when screen is rotated?

Much appreciated.

Custom Renderer erroneously instantiated multiple times

$
0
0

I have a Master-Detail pattern Xamarin Forms app in which the landing detail page has a HybridWebView in it.

On iOS, I have created a custom renderer for that Xamarin Forms HybridWebView.

The problem is that every time I leave the page by clicking a Master item, and then come back into this page, that an additional instance of the custom renderer is created: I've proven this because I create an ID for each renderer in it's constructor, when it is created.

Because both are bound to a Uri in the viewmodel, they both make a call to the uri.

Of course the user sees only one, but I need to stop this behaviour!

Any ideas how this is occurring?

Kind regards,

Anthony

The renderer is a WKWebView, btw!

Custom layout for TabbedPage tabs

$
0
0

Hi.

Can I edit the tabs' layout of a TabbedPage to be like I want?
I mean, I want to customize the tabbar layout with my own, like in the image below:

How can I achieve this?
I need to create a custom User Control? I need to create a custom Layout?

Thank you so much.
I'm very grateful for this community and Xamarin team.

Best regards.

Listview Issue

$
0
0

Hello i am now having a problem with my listview
this is what were trying to achieve

but i get stuck because i have no idea how i can like cut viewcells and place them next to eachother.

            <ListView.ItemTemplate>

                <DataTemplate>

                    <ViewCell>

                        <StackLayout>

                            <StackLayout HorizontalOptions=" VerticalOptions=" HeightRequest=" WidthRequest="100">

                                <Image Source="{Binding ImageNaam}"
                                       Aspect="AspectFit"/>
                            </StackLayout>

                            <Label Text="{Binding GerechtNaam}"
                                   TextColor="Black"
                                   FontAttributes="Bold"
                                   HorizontalOptions="Center"
                                   VerticalOptions="Start"/>

                        </StackLayout>

                    </ViewCell>

                </DataTemplate>

            </ListView.ItemTemplate>

        </ListView>

How to compress SignaturePad Image?

$
0
0

Hello,
I am using Signature Pad in my application and I want to compress my image before getting it.So is there any compression method for signature pad?

Tailwind Traders TwoProductItemTemplate Binding

$
0
0

Hi! I've been going through the Tailwind Traders app, examining their code and learning a bunch, attempting to replicate a lot of their stuff to gain the experience. I'm currently stuck on how they're databinding their ProductView XAML to their ProductViewModel? I notice in the codebehind for the ProductCategoryPage in their WireProductsUpWithListView method that they are merely setting their ListView's source to basically a list (tuple) of ProductViewModels.

I similarly have a ListView that is successfully binding to my custom ItemTemplate, and I even get each item to show in the ListView, the data isn't being bound however.

I have a feeling it lies in their ItemTemplate, the code I'm having a hard time understanding:

  <local:ProductView BindingContext="{Binding Item1}" />

  <local:ProductView
    Grid.Column="1"
    BindingContext="{Binding Item2}"
    IsVisible="{Binding ., Converter={StaticResource IsNotNullConverter}}" />

I understand this is just for creating 2 columns of ProductView, and an empty space for if there is an odd number, but I cannot for the life of me figure out how they are BindingContext = "{Binding Item1}". I can't figure out what exactly that Item1 or Item2 is, I have searched the entire solution for what it's binding to, with no luck. From my understanding, shouldn't their BindingContext's be to the ProductViewModel? I haven't managed to find anything substantial online for this kind of binding, unless I suck at Google haha, any help would be appreciated!

how I can do my WebView app multi language?

$
0
0

Hello

I want do my Xamarin form app multi language, no only display information by on url ( Spanish on this casi) but I will like display Spanish url if device is in Spanish and if not display English url, how I can do it?

Now I have this on MainPage.xaml.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace APPNAME
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();

        WebView webView = new WebView
        {
            Source = new UrlWebViewSource
            {
                Url = "SPANISH URL"
            },
            VerticalOptions = LayoutOptions.FillAndExpand
        };

        // Build the page.
        this.Content = new StackLayout
        {
            Children =
            {
                webView
            }
        };
    }
}

Thanks for your help

How do I integrate the Stripe API into Xamarin.Forms PCL?

$
0
0

Hello community! I noticed recently that the Xamarin Stripe component and documentation no longer exist. Can someone provide an example on how to integrate the Stripe API into a Xamarin.Forms PCL application please? I must be able to process credit card payment from users when they click a Button view. I have a page with Entry views, such as Name on Card, Credit Card Number, etc. and a Button at the bottom. Thank you!

Obfuscate Xamarin Forms Projects on Mac

$
0
0

I am looking for a code obfuscator for Mac that can obfuscate Xamarin projects via terminal. I am using Jenkins with the intentions to build and obfuscate apps for both Android and iOS platforms. It will also need to be able to obfuscate internal nuget packages that are referenced by the main Xamarin project. The internal nuget packages are projects I built and have control over the source. Is there an obfuscator that can fulfill these requirements?

Viewing all 91519 articles
Browse latest View live


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