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

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?

How to set binding context with Source={x:reference view } in ResourceDictionary

Xamarin.Forms and NotificationHub; RegisterAsync error

$
0
0

With a Xamarin.Forms app that needs to register with a NotificationHub from the specific platform (in my case Android) I get the error 404 0 2 with message : "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable".

Provided that the NotificationHub was working correctly until few days ago, I suppose that something is not working properly in NotificationHub.

The exception occurs when device needs to register :

var client = new MobileServiceClient(MyApp.App.MobileServiceUrl);
var push = client.GetPush();
await push.RegisterAsync(token, templates); <=================== results in 404 Error

The MobileServiceUrl is an App Service backend connected with the Azure Notification Hub.

Has someone else solved the same problem?

Thanks,

Enrico.

Unable to launch application after updating to latest version of Visual Studio for Mac

$
0
0

Hello,

I am working on a Xamarin Forms application. Everything was fine until I updated Visual Studio for Mac to the latest version of Xamarin and Mono. Now users are unable to open the application on their iOS devices. After install, when they click on the app icon the application launches and then immediately closes. I have gone through the logs and found the following error:

error 09:40:36.951392 -0500 assertiond Failed to start job with error <NSError: 0x7f97f2801640; domain: NSPOSIXErrorDomain; code: 3; reason: "No such process"> { description = "Unable to get pid for label UIKitApplication:com.myapplication[0xca85][1468]"; failureReason = "No such process"; userInfo = { BKLaunchdJobLabel = UIKitApplication:com.myapplication[0xca85][1468]; BKLaunchdOperation = launch_get_running_pid_4SB; } }

After some searching online I have found similar posts where the issue is that certain certificates were set to "Always Trust" instead of "Use System Defaults". However, I have checked all the related certificates (Apple Worldwide Developer Relations Certification Authority, Developer ID Certification Authority, iPhone Developer, and iOS Distribution). They are all set to use system defaults.

Has anyone else experienced this issue? If so, how did you resolve it?

Thank you

What's the best way to expose a Model object in a ViewModel?

$
0
0

Hi developers ! :smile:

I'm begginer into xamarin development and also consider myself as beginner programmist. For some time i'm trying to refactor my app which i wrote first without any design approach or deeper thinking about adding more features to it. Now i face a problem with applying mvvm design pattern which i want to learn before i will start to looking for some internship. I read many tutorials (10 pages next in google ) seen about 50 tutorials on youtube :cold_sweat: and all of them are missing one important thing for me or i just not understoodem well.I tired to expose my model in view model but i don't figure it out how to do it properly becouse i still seeing on output console that my command hasn't found a property bound to it.

How to expose model properties in view model to be able to menage them in view model. ? I want to be able at least increasing one property value of my object by command in view model ? How to menage with this problem ? If you have some links or any your explanation i would be very greatefull for that or just sample example. Any help very appreciate. :smile:
I tired to expose my model in view model but i don't figure it out how to do it properly becouse i still seeing on output console that my command hasn't found a property bound to it.

My final tried before asking here :

        public Waste _wasteModel {
            get
            {
                return _waste;
            }
            set
            {
                _waste = value;
                OnPropertyChanged();
            }
        }

public double Counter
        {
            get
            {
                return _waste.Counter;
            }
            set
            {
                _waste.Counter = value;
                OnPropertyChanged();
            }
        }

Provisioning profiles in visual studio 2017

$
0
0
Hello experts

I have a problem with my new provisioning profile created in the apple developer portal I can see it in the Xcode but no in visual studio I already reconnect the Mac server I don’t know why the profile don’t show up

Thanks in advance.

Custom context menu for ViewCell

Xamarin Forms Listview Example

$
0
0

I am fairly new to xamarin and I am trying to create a list view, using xamarin forms and mvvmcross.
I am trying to follow a tutorial I found online, I can't give the link yet.
This gave an error because he, set the binding context to his viewmodel.
But my viewmodel has parameters, I used a prebuilt template, and I can't pass them from the page code.

His code:

public partial class CarsPage : ContentPage {

    public CarsPage() {

        InitializeComponent();

        // Connecting context of this page to the our View Model class
        BindingContext = new CarsViewModel(); // it crashes on this line in my code.
    }

}

My viewmodel code:

    private MvxObservableCollection<VoorwerpItem> voorwerpen;
    public MvxObservableCollection<VoorwerpItem> Voorwerpen
    {
        get { return Voorwerpen; }
        set
        {
            Voorwerpen = value;
        }
    }


    public MainViewModel(IMvxNavigationService navigationService, IMvxLogProvider mvxLogProvider, Services.IAppSettings settings, IUserDialogs userDialogs)
    {
        this.navigationService = navigationService;
        this.mvxLogProvider = mvxLogProvider;
        this.settings = settings;
        this.userDialogs = userDialogs;

        this.log = mvxLogProvider.GetLogFor(GetType());

        Voorwerpen = new MvxObservableCollection<VoorwerpItem>()
        {
             new VoorwerpItem() { Name = "Fiets E", Type = "fiets" }
        };

    }

I have search a lot online trying to find a example of a listview with forms and mvvmcross that works.
However I have been unsuccesfull so far.
How can I have a listview with mvvmcross?
Any example or derication is much appreciated.
I am sorry for not being able to give an better question.

SetBinding in Image with ListView and CustomCell

$
0
0

Hi guys, I want to make a ListView that the image from each item depends on the type of item like the image below:

Now I'm using a CustomCell for the listview :

     public class PlaceCustomCell:ViewCell
        {
            public PlaceCustomCell()
            {
                var nameLabel = new Label
                {
                    FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                    FontAttributes = FontAttributes.Bold
                };
                nameLabel.SetBinding(Label.TextProperty, new Binding("name"));

                var placeImage = new Image
                {
                    Source = "icon.png",
                    HeightRequest = 48,
                    WidthRequest = 48,
                    Aspect = Aspect.Fill
                };

                View = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Padding = new Thickness(15, 5, 5, 15),
                    HeightRequest = 75,
                    Children = {
                        new StackLayout {
                            Orientation = StackOrientation.Horizontal,
                            Children = { placeImage, nameLabel }
                        }
                    }
                };
            }
        }

Should I use setBinding for the imageSource or can I use another thing?
This code will work for Android and iOS?

Thanks

Hide a specific child page of a CarouselPage

$
0
0

Hi Guys,

I need a way to hide a specific carousel page. I do not want to remove the page as a whole because then I would lose all the changes made on that particular page which I want to maintain like Field changes, Scroll position, control states and so on. Possible? I dont mind using TabbedPage is this feature is only possible on that.

Thanks.

Separate Key Pair using PCLCrypto (Windows.Security.Cryptography)

$
0
0

I want to separate the key pair using PCLCrypto, but 'CryptographicEngine.Encrypt' and 'CryptographicEngine.Decrypt' expects a 'ICryptographicKey' that the description says : "Represents a symmetric key or an asymmetric key pair", that means it cannot be a just the public or just the private asymetric key ?
Because I need the server to have one and the user the other, how do I separate them into a 'ICryptographicKey' type?

That's what I have working :

using PCLCrypto; using static PCLCrypto.WinRTCrypto; //... ICryptographicKey keyPair = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithm.RsaPkcs1).CreateKeyPair(512); var encrypted = CryptographicEngine.Encrypt(keyPair, Encoding.UTF8.GetBytes("ANYTEXT")); var decrypted = CryptographicEngine.Decrypt(keyPair, encrypted); string = Encoding.UTF8.GetString(decrypted, 0, decrypted.Length);

FAILED to separate the private key like that, throws an Exception saying private key is missing :
byte[] byteKeyPubl = keyPair.ExportPublicKey(); ICryptographicKey keyPubl = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithm.RsaPkcs1).ImportPublicKey(byteKeyPubl); //then var decrypted = CryptographicEngine.Decrypt(keyPubl, encrypted);

Besides that i'd also need to separate the private key, that doesn't even have a function like '.ExportPublicKey()'.

:) thanks already

Unable to build after upgrading to Xamarin.Forms 3.4 or 4.0 from 3.3

$
0
0

Hi Guys, hope you can help because this is driving me nuts.

After updating Xamarin Froms to either 3.4 or 4.0, I get a build error for every XAML file.

If I upgrade to 3.4 then the error is:

Valu cannot be null, parameter name method

If 4.0 then it varies between:

Type Color not found in xmlns xamarin. com/schemas/2014/forms
Type Binding not found in xmlns xamarin. com/schemas/2014/forms
Type StaticResource not found in xmlns xamarin. com/schemas/2014/forms
Type RowDefinition not found in xmlns xamarin .com/schemas/2014/forms

I have killed bin and obj directories, cleared nuget cache, turned everything on and off again.

Also tried in Visual Studio 2017 (15.9) & 2019 and the same happens

By using xamarin's media plugin i,m trying to upload photo to azure database.

$
0
0


By using xamarin's media plugin i,m trying to upload photo to azure database that time got a problem which is mentioned in image.
need your smart help.
Thank you.!


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?

When we Opening the Gallery from App.The design of the screen and Text changed to different

$
0
0

When we Opening the Gallery from App.The design of the screen and Text changed to different Positions.
how to solve the problem if any please suggest.

it will come correctly when close the page and after re open

how to accept rich content(Gifs/stickers) in Entry or Editor from keyboard

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.

xam.plugin.filepicker error "Only one operation can be active at a time"

$
0
0

After open the filepicker, without select any file, im just click go back and it will comeback to where it was. But filepicker is not disposed and throw error. "Only one operation can be active at a time""

Viewing all 91519 articles
Browse latest View live


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