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

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.

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


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""

Content Page Secondary Toolbar Items in iOS same as Android

$
0
0

I am using secondary toolbar items in my content page. I want the same menu items in iOS as in android. By default it is showing under navigation bar. How can I achieve this.

Xamarin Navigation

$
0
0

I am developing cross-platform apps using xamarin form.

I would like to know how to implement navigation drawer in both iOS and Android.

Regards,
Simto

Google Drive Rest API

$
0
0

Hi, I am trying to implement a feature in my app where the user logs in on their Google account and can upload/download to their Drive.
I have a functioning solution using Android.Gms.Drive, and Android.Gms.Auth.Api.SignIn, but, unsurprisingly this only works for android and with the deprication of Google Drive Android API, this will need to be migrated to the rest api anyway.

The question I have is, are there any good tutorials for implementing this? The one I find aren't intended for Xamarin, along with the fact that I am uncertain which libraries are best for the situation.

Any suggestions are appreciated.
Thank you for your time and assistance.

Position of InitializeComponent

$
0
0

I have question with regards to the position InitializeComponent in the App.xaml.cs ?

If I place InitializeComponent below the MainPage statement, the style.css styles will be be applied in all the pages. Is this a bug or work by design ? If it is a work by design then there should be a big warning in the Docs as I can cause hours or days of head banging to locate the issue.

public App()
{
    InitializeComponent();

    MainPage = new NavigationPage( new MyOwnPage());

}


    <Application.Resources>
               <StyleSheet Source="/Assets/style.css"/>
     </Application.Resources>
Viewing all 91519 articles
Browse latest View live


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