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

Troubles with Gmail authentication

$
0
0

Hello, I'm trying to implement Gmail authentication on my Xamarin Forms app. Searching for solutions I found to libraries which I can use. Implementations both of them turns error to me. First I tried the Xamarin.GooglePlayServices.Auth. I do all which was described in this article: https://causerexception.com/2017/12/03/google-native-login-with-xamarin-forms/ . I do exactly as it was described event set all of my libraries to the same version, but during compilation it throw exception: ImageManager_OnImageLoadedListenerImplementor is not abstract and does not override abstract method onImageLoaded(Uri,Drawable) Then I tried to delete all code which connected with image downloading but still have the same error.
The second version was Xamarin Auth library. I follow Xamarin site https://docs.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/authentication/oauth#android. It compiles fine, however, it throws Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup I google this error, so I check my Google+ API service was enabled, and scope was correct.
Now I stuck and would be thankful for any help.


is XAML Compilation working in XF 2.3.1.114 - INVALID IL CODE message displayed

$
0
0

We have an issue when we turn on XAML Compilation at the assembly level. The problem occurs in all platforms and only occurs when the application is deployed to an emulator/real device and the application is launched.

The issue/error we receive is one of an INVALID IL CODE

The attached images show the XAML used (Highlighted) that causes the INVALID IL CODE - When we compile without XAMLCOMPILATION - no errors occur and the app runs as intended.

The IL errors for both cases are :

09-05 13:41:16.336 I/MonoDroid( 6261): ---> System.InvalidProgramException: Invalid IL code in ModuleSettings.Views.SettingsFields:InitializeComponent (): IL_01cf: callvirt 0x0a000026

and

09-05 13:53:25.612 I/MonoDroid( 6716): Exception is: InvalidProgramException - Invalid IL code in ModuleSettings.Views.SettingsFields:InitializeComponent (): IL_0254: callvirt 0x0a000034

The FULL XAML that is defined is attached (Note actual production code is stripped out to demonstrate purely the error we receive)

How is ResourceDictionary MergedWith feature meant to work?

$
0
0

I'm tying out the MergedWith feature in ResourceDictionaries in Forms (Xamarin.Forms.2.3.1.111-pre2).

I have specified the main ResourceDictionary in App.xaml like:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:custom="clr-namespace:Demo.Custom.Styles;assembly=Demo.Custom"             
             x:Class="Demo.App">

  <Application.Resources>  
    <ResourceDictionary MergedWith="custom:CustomResources">
      <Style x:Key="TitleBarStyle" TargetType="StackLayout">
        <Setter Property="BackgroundColor" Value="Blue" />
      </Style>
      <Color x:Key="Color_1">Red</Color>
    </ResourceDictionary>
  </Application.Resources>  
</Application>

The dictionary that I am trying to merge (CustomResources) is a xaml file in another portable project as follows:

<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                x:Class="Demo.Custom.Styles.CustomResources">
  <Style x:Key="TitleBarStyle" TargetType="StackLayout">
    <Setter Property="BackgroundColor" Value="Yellow" />
  </Style>
  <Color x:Key="Color_1">Green</Color>
</ResourceDictionary>

When I debug the application, I can see that the dictionaries have merged since Resources.count gives 4 (two resources in each dictionary), but the Keys & Values count is still 2. Looking deeper the keys and values are from the original dictionary. Looking at the Resources.IEnumerator values I can see all 4 resources as key:value pairs confirming that both dictionaries have merged.

This not exactly the way I was expecting merging would work. This is how it is specified in the docs:

"The ResourceDictionary specified as the value of the MergedWith property is merged into the current ResourceDictionary instance. Note that any resources in the current ResourceDictionary that share x:Key attribute values with resources in the ResourceDictionary to be merged, will be replaced."

I thought I would end up with two resources with values from CustomResources.xaml since the x:Keys are the same in both dictionaries. Is this a bug or have I misunderstood something? How am I meant to use dictionary values elsewhere if the merging works like above? I thought I would use them by the key simply as in 'Style="{DynamicResource TitleBarStyle}"' like normally.

Problem with XAML x:Name and access from code-behind

$
0
0

Hi all.

I'm new to Xamarin Forms and have made a Xamarin Forms PCL project and added a few pages to it. So far the app is compiling and running fine on my samsung galaxy s5. :D But when a make a new Entry tag in the xaml file and give it a x:Name so that i can access it from code-behind, i can't, i need to restart Xamarin Studio to access it and se all the methods and properties is has. I have tried to search google for a similar problem, but with no luck.
So my question is, does someone know how to solve this problem? As far as i know, it has something to do with a g.cs file no being generated.

My system is a Macbook Air fully updated, and with Xamarin Studio 5.5, and i have a indie license for android.

Kind regards
Steffen

How to handle different screen sizes

$
0
0

Hi,

are there any tutorials for xamarin forms on how to handle different screen sizes for iOS, Android and Windows Phone 8 ?
The only tutorials I could found was about apple and android watch.

How to implement Parallax ListView sticky header view [Xamarin Form iOS and Android]

$
0
0

Hello All,

I want to make Parallax ListView using Xamarin form [iOS and Android]

need parallax banner image and sticky header for the list view.

example like this video www.youtube.com/watch?v=eyWDkwVnYxo

How can I do this?

How to use Firebase cloud services in Xamarin Forms app ?

$
0
0

Hi folks,

should i use separately for sampleApp.droid and sampleApp.ios or is there common code.
thanks in advance.

convert java code to xamarin forms

$
0
0

Hi, i am new in xamarin forms and i want to implement image encryption and decryption. I have java code that do the encryption and decryption for the image and i want to convert it to C# that work in xamarin forms and this is my java code can any one covert it to me please.

package imageencryptanddecrypt;

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.security.SecureRandom;
import javax.imageio.ImageIO;


public class ImageEncryptAndDecrypt {


   public static void main(String s[]){

    String sPath="picture.jpg";
    String dPath="picture.jpg";
    String password="1234";
   StringBuilder sb=new StringBuilder();
    char st; 
    int value;
    try{
        for (int i = 0; i < password.length(); i++) {
             st=password.charAt(i);
             value=(int)st;
             sb.append(value);
        }
    SecureRandom sr= SecureRandom.getInstance("SHA1PRNG");
    sr.setSeed(sb.toString().getBytes());
    BufferedImage FSImg=ImageIO.read(new File(sPath));  
        for (int w = 0; w < FSImg.getWidth(); w++) {
            for (int h = 0; h < FSImg.getHeight(); h++) {
                Color color=new Color(FSImg.getRGB(w, h));
                Color newColor=new Color(color.getRed()^sr.nextInt(255), color.getGreen()^sr.nextInt(255), color.getBlue()^sr.nextInt(255));
                FSImg.setRGB(w, h, newColor.getRGB());
            }
        }
    System.out.println("Process Completed!!..");
    ImageIO.write(FSImg, "bmp", new File(dPath));
    System.out.println("Wrote to "+dPath);
    }catch(Exception e){
    e.printStackTrace();}
    }

}

Cancelled Button Event in Search Bar in Xamarin Forms

$
0
0

Can any help me how to trigger an event when cancel button on Search bar is Pressed. I want to refresh the listview when i press the cancel the button

Keyboard property not working on entry renrerer

$
0
0

I have a custom renderer for entry,while adding keyboard property to the XAML then it will not work.

I set keyboard="Numeric" but it shows full keyboard,but unable to type alphabet only numeric key working.so how to show numeric keyboard with entry custom render?

JObject response = JsonConvert.DeserializeObject(json); not working properly.

$
0
0

var json = await httpClient.GetStringAsync(
"https://www.instagram.com/"
//https://www.instagram.com/tmteice/#access_token=7376071860.4a7135d.99d3c8a954d64424889fe17e16b96ee0
);

        JObject response = JsonConvert.DeserializeObject<dynamic>(json);


        var items = response.Value<JArray>("items");

        try
        {

            var instagramItems = new List<InstagramItem>();

            foreach (var item in items)
            {
                var instagramItem = new InstagramItem
                {
                    UserName = item.Value<JObject>("user").Value<string>("username"),
                    FullName = item.Value<JObject>("user").Value<string>("full_name"),
                    ProfilePicture = item.Value<JObject>("user").Value<string>("profile_picture"),
                    LowResolutionUrl = item.Value<JObject>("images").Value<JObject>("low_resolution").Value<string>("url"),
                    StandardResolutionUrl = item.Value<JObject>("images").Value<JObject>("standard_resolution").Value<string>("url"),
                    ThumbnailUrl = item.Value<JObject>("images").Value<JObject>("thumbnail").Value<string>("url"),
                    Text = item.Value<JObject>("caption").Value<string>("text"),
                    CreatedTime = item.Value<JObject>("caption").Value<string>("created_time"),
                    LikesCount = item.Value<JObject>("likes").Value<int>("count"),
                    CommentsCount = item.Value<JObject>("comments").Value<int>("count"),
                };

                instagramItems.Add(instagramItem);
            }

            InstagramItems = instagramItems;
        }
        catch (Exception ex)
        {

        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

}

Automatic Reference Counting not enabled in Xamarin forms

$
0
0

Hello. I'm seeing the security of my application and I have to enable the ARC (Automatic Reference Counting) in xamarin forms. t's possible for ios project (Xamarin Forms)? Thanks for your time.

How to get back to app after google login

$
0
0

Hi Everyone,

I'm trying to implement google login in my app using xamarin.auth like below

var auth = new OAuth2Authenticator("284202576320-7kgdhaa5sgvkoe03jmmcv0p8lfdma306.apps.googleusercontent.com","cAZW7uegD-h2-
                                                             tNMMf5q1UGQ","https://www.googleapis.com/auth/userinfo.email",new 
                                                             Uri("https://accounts.google.com/o/oauth2/auth"),new 
                                                             Uri("http://dev.myfav.restaurant/Account/LoginComplete"),new 
                                                             Uri("https://accounts.google.com/o/oauth2/token"),null,true)
        {
            AllowCancel = true,                
        };

but Completed event not firing and its going to web page after login :( i need to get back user to my app how can i achieve this ???? Can anyone help me on this please.

Thanks in advance

Can't resolve cornerRadius on Button for iOS 11 for xamarin forms app

$
0
0

When running a xamarin forms app on iOS 11 get an error

Can't resolve cornerRadius on Button

Works fine on android.
Would I have to write a custom renderer to set button's **clipsToBounds ** property to true or is there any other way to achieve that

Is possible connect to a specified WIFI in iOS?

$
0
0

I have a SSID and password for a WI-FI and i try to connect it automatically. I have found the solution for Android, but have anyone same solution for iOS?


Creating Round Buttons with centered Image and Label

$
0
0

Hey together,

i'm quite new to xamarin forms and i would like to create some buttons like in the image linked next.

us.v-cdn.net/5019960/uploads/editor/ot/ox4hgakakrig.png

I tried something ike this:

<StackLayout Orientation="Horizontal">
            <Button ContentLayout="Top,-70" 
                    VerticalOptions="EndAndExpand"
                    HorizontalOptions="CenterAndExpand" 
                    Text="Label" 
                    FontSize="20"
                    Image="ic_home_white_72dp.png" 
                    WidthRequest="120" 
                    HeightRequest="120"  
                    BorderRadius="60" 
                    BackgroundColor="#3F51B5" 
                    TextColor="#FFFFFF" />

            <Button x:Name="button_app"
                    ContentLayout="Top,-70" 
                    VerticalOptions="EndAndExpand"
                    HorizontalOptions="CenterAndExpand" 
                    Text="Apps" 
                    FontSize="20"
                    Image="ic_apps_white_72dp.png" 
                    WidthRequest="120" 
                    HeightRequest="120"  
                    BorderRadius="60" 
                    BackgroundColor="#3F51B5" 
                    TextColor="#FFFFFF" />

            <Button ContentLayout="Top,-70" 
                    VerticalOptions="EndAndExpand"
                    HorizontalOptions="CenterAndExpand" 
                    Text="Telefon" 
                    FontSize="20"
                    Image="ic_phone_white_72dp.png" 
                    WidthRequest="120" 
                    HeightRequest="120"  
                    BorderRadius="60" 
                    BackgroundColor="#3F51B5" 
                    TextColor="#FFFFFF" />
            </StackLayout>

This is the output I'm getting
us.v-cdn.net/5019960/uploads/editor/e8/l0j5sqh1lrv1.png

How could i archive that the images in the buttonsare getting centered? Maybe with a custom button?

Unable to notify second device when receive image from blob

$
0
0

I am working a chat application and I am using blob for image store when when I upload a image with button click then receive image doesn't received to another device only sender device showing it.

Upload and Receive code:
using (var memoryStream = new MemoryStream())
{
activityIndicator.IsRunning = true;
file.GetStream().CopyTo(memoryStream);
file.Dispose();
// return memoryStream.ToArray();
uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Image, new MemoryStream(memoryStream.ToArray()));
}

            if (!string.IsNullOrWhiteSpace(uploadedFilename))
            {
                var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, uploadedFilename);

                var img = ImageSource.FromStream(() => new MemoryStream(imageData));

                TextContainer.Add(new MessageText { imgsource = img });
                activityIndicator.IsRunning = false;


            }

public ObservableCollection TextContainer { get; set; } = new ObservableCollection();

public static async Task UploadFileAsync(ContainerType containerType, Stream stream)
{
var container = GetContainer(containerType);
await container.CreateIfNotExistsAsync();

        var name = Guid.NewGuid().ToString();
        var fileBlob = container.GetBlockBlobReference(name);
        await fileBlob.UploadFromStreamAsync(stream);

        return name;
    }

Picker WidthRequest .

$
0
0

Hello ! I try to put WidthRequest for Picker and in the windows it's does not work . But if I not use this parameter is does not work good in android . In both case is problem too small Picker and is present only begin of the item . How can I solve this problem ?

InitializeComponent does not exist in the current context error

$
0
0

Hi,

The error CS0103 (The name 'InitializeComponent' does not exist in the current context) has started appearing after doing a build of our Xamarin Forms solution. The build, however, appears to have succeeded in spite of this error message?

This started happening after adding the first XAML ContentPage to the PCL project. If I remove the XAML ContentPage then the error disappears.

I've tried installing the latest Alpha channel update on both my Windows (Visual Studio) machine and my Mac build host but it hasn't made any difference.

Please advise ASAP as we would like to use XAML for our ContentPages but may have to revert to using C# code to build the UI if the XAML approach is not viable.

Regards,
Andy

Google translate API in Xamarin Forms

$
0
0

I want to use the Phrasebook (the bookmarked words in Google translate) of the logged-in Google user in a Xamarin Forms application, is it available?

Viewing all 77050 articles
Browse latest View live


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