Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

find component that was installed with xamarin-component.exe

$
0
0

hello,
I want to use die U grok It api for xamarin. So I followed there guide. https://dev.ugrokit.com/xamarin/xamarin.html
the file (.xam) seems to be installed right (it is at least in the %LocalAppData%\Xamarin\Cache\Components folder). But when I search for the component inside my project, it does not show up.


Maps Ios position difference

$
0
0

Hi all,

I have follow this link
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/map/customized-pin/

But i have a problem on Ios on function "GetCustomPin" :

PinMotoAlarm GetCustomPin(IMKAnnotation annotation)
        {
            var nativelement = (CustomMap)this.Element;
            var position = new Position(annotation.Coordinate.Latitude, annotation.Coordinate.Longitude);
            foreach (var pin in nativelement.CustomPins)
            {
                if (pin.Position == position)
                {
                    return pin;
                }
            }
            return null;
        }

Position of annotation is never equal with my custon pin. It's normal ?

Thanks in advance for help.

How to store files in a public location

$
0
0

Hi
I have been researching this for some time now and cannot find out how to do this.
Can anybody please tell me how I can store files in a public location on Android and iOS?

In my case I download files such as pdf, word and excel. I need to save in a public location so that I can get external apps to open it.

Databinding ListView in Xamarin.Forms does not seem to work in UWP

$
0
0

Here is the relevant code:

public class SelectClientPage : ContentPage
{
    public SelectClientPage(ClientResult[] clients)
    {
        this.BindingContext = new SelectClientViewModel(this, clients);

        var layout = new StackLayout { Padding = 20 };

        var list = new ListView
        {
            ItemTemplate = new DataTemplate(typeof(ClientListTemplate)),
            BackgroundColor = MobileColor.LightOrigamiBlue.ToFormsColor(),
            HasUnevenRows = true,
        };
        list.SetBinding(ListView.ItemsSourceProperty, "Clients");
        list.SetBinding(ListView.SelectedItemProperty, "SelectedItem");

        layout.Children.Add(list);

        this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
        this.Content = layout;
    }

    public class ClientListTemplate : ViewCell
    {
        protected override void OnBindingContextChanged()
        {
            ClientResult client = (ClientResult)this.BindingContext;
            var pad = new ContentView {
                Padding = new Thickness(5,5),
                Content = new Label
                {
                    Text = client.name,
                    TextColor = Color.White,
                    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(ListView))
                }
            };
            this.View = pad;
        }
    }
}

This code works fine in iOS or Android. However, in UWP, it fails in this line in the ClientListTemplate class:

ClientResult client = (ClientResult)this.BindingContext;

The reason it fails is because the BindingContext passed in to the ViewCell is of type SelectClientViewModel, which was assigned to the BindingContext of the content page initially. So it throws an Invalid Cast Exception.

Has anybody else encountered this? I'm on Xamarin.Forms v2.3.3.175.

Thanks.

Storyboard does not load anymore after upgrading Xcode to version 9.1 (9B55)

$
0
0

After the update of Xcode to build 9b55 this morning my storyboard did not load anymore.

Xcode is too new
'This file has been edited in a version of Xcode which is unsupported by the designer. Documents saved in Xcode 9.1 format, or older, are supported.'

I did not even open the storyboard in Xcode Designer... I use the alfa channel 7.3 Build 708 of Visual Studio.
Is there anything that I can change in the XML of the storyboard to make it open in Visual Studio again ?

The storyboard starts with :

<?xml version="1.0" encoding="UTF-8"?>

Would lowering the toolsVersion work ? If so, what would be a "good" version ?

Thanks

Bert

Xam Consulting is hiring! (Sydney, Australia)

$
0
0

Want to work at Australia's top Xamarin consultancy?

Xam Consulting is hiring!

We are looking for a mid-to-senior Xamarin developer to work on everything from greenfield apps to project rescues to customer training.

Interested?

Then apply here! https://www.seek.com.au/job/35054051

VS on Mac Constraints

$
0
0

VS on Mac for xamarin just got update and the IDE changed and the auto constraints button is gone.
Get replaced ,moved???

Xamarin IOS Version on Mac is not compatible with local version

$
0
0

Hello,

I am getting the below error when I try to connect to Mac Agent from my Visual Studio, as I understand I need to update my MAC but since I am using macincloud.com option, I don't have permissions to update MAC. Is there a way to check the version on my Visual Studio and downgrade it to match with my MAC Version.

"The installed Xamarin.iOS (version 10.4) on the Mac xxx.xxx.xxx.xxx is not compatible with the local Xamarin.iOS (version 10.8)"

Any help is highly appreciated.


VS Mac Ios Scrollview

$
0
0

I can do the hard stuff but this agrevating me. Get an Ios app view to scroll. I have a sample solution from another forum member , it builds and runs in the sim fine. I cant get my stupid hello world scroll to move. Simp single view using the Storybook. Have the controller, it is set for freeform and the view is extended. added the a scrollview from tool box added views and button. It builds show the top of the view but wont scroll down. What am i missing???? information is vague or deprecated. Thanx for reading and any feedback.

error when add new form on pcl project.

$
0
0

i create a new xamarin project on visula studio 2017 (blanck app and pcl), then i add the nuget library 'xamarin.forms'. when I try to add a new form, visual study retains an error, inserts the form without its '.cs' file.
the problem does not appear in the 'shared' projects.

any ideas?

thanks

Capture Build Commands That Are Used in Visual Studio for Mac

$
0
0

Is there a way to see/log the build commands that Visual Studio for Mac uses to build Xamarin.iOS and Xamarin.Android projects?

I'm working on some automated builds in Jenkins and I'm running into some issues when using msbuild on a Mac (builds succeed, but incorrect configuration is being used and simulator builds won't install on a simulator). I want to compare my command line arguments with whatever Visual Studio for Mac is doing (builds work as expected from Visual Studio for Mac).

App builds on VS for windows but VS for mac has build errors

$
0
0

I can build and run the app on my android phone from VS on windows, but when i pull the exact codebase down onto my mac i am getting an issue that says "Acr.UserDialogs" namespace not found.

I have tried deleting the nuget package and reinstalling, this will take away the red underline from the using statements. However, they get re-added and the error shows up when i go to build.

The app however is fully functional when built from a windows machine. Problem being I can no longer deploy to the App store.

This started after I updated all my xamarin.forms packages and the acr.userdialogs package.

Android Emulator fails to execute and doesn't start

$
0
0

Hi,

It's pretty weird but since like 2 weeks, I can't start my android emulator Android_Accelerated_x86.

Starting emulator for AVD 'Android_Accelerated_x86'
Failed to open vm 4
Failed to create HAX VM
No accelerator found.
failed to initialize HAX: Invalid argument
Hax is enabled
Hax ram_size 0x40000000

Before, it was working perfectly, what do you think could the cause?

Thank in advance

Timestamp in strings

$
0
0

Dears,

I have a Label inside listview-viewcell, to show time in UI. The date is received as a number like 1510822596449 (Java timestamp). I want to show the date in strings like "n days ago". How can I achieve this?

<StackLayout>
    <ListView>
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                <StackLayout>
                    <Label Text="{Binding createdTime}"/>
                    </StackLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
</StackLayout>

I try IValueConverter in the following link, but it is not working.
https://stackoverflow.com/questions/32814176/how-to-format-date-and-time-in-xaml-in-xamarin-application

Anybody, please suggest a solution with working code. Thanks in advance.

Call Javascript from C# method with parameter.

$
0
0

Hi,

I have some html pages that is working fine in WebView Xamarin forms (iOS/Android).
I have one c# method that i need call from Html page javascript function.
please give me any example or any solution code.

Thanks


Native linking error: framework not found IOSurface for architecture arm64

$
0
0

I am trying to use the UGROKIT xamarin sdk but am running into issues in the IOS project. I can make a build just fine for Android but when I try and do it for my IOS project I get the following errors:

Error Native linking failed. Please review the build log. ApiDemoIos
Error Native linking error: framework not found IOSurface for architecture arm64 ApiDemoIos

I am using VS2015 and on xamarin.forms 2.3.4.247.

I also tried without Xamarin.Forms and justing using Xamarin.ios but having the same issue.

Any help would be appreciated.

Custom Fonts and the Xamarin Live Player

$
0
0

Will custom fonts be displayed in the Live Player?

Select and Upload Multiple Images to Web Server Using ANDROID?

$
0
0

i want to know that how i can Select & Upload Multiple Images to a Web Server. i m currently using Xamarin Studio.
Until now i am Successful to Select & Upload 1 Image only. On Server Side i am Using PHP.

below are the steps Required:

1) Fetch All the images from Android Device (Phone Memory or SD Card Memory)

2) Show all the Images in New Page may be in Grid View format Including with Check-box with Each Image (If Can).

3) Then Select them as many as you want to Select (1-- All).

4) Then Just Press on the Upload Button to Send the Images to Web Server

this is Total of my Project.i need you people help to Do that. waiting for you People Reply.

Below is my Code to Upload One Image on Web Server

C# Code in Xamarin Studio

//Variable Declaration
public static readonly int PickImageId = 1000;
private ImageView _imageView;
String path = null;

#region Click the Button to Select the Image
                private void ButtonOnClick(object sender, EventArgs eventArgs)
                {
                    Intent = new Intent();
                    Intent.SetType("image/*");
                    Intent.SetAction(Intent.ActionGetContent);
                    StartActivityForResult(Intent.CreateChooser(Intent, "Select Picture"), PickImageId);
                }
                #endregion

            #region Get the Path of Selected Image
            private string GetPathToImage(Uri uri)
            {
                string path = null;
                // The projection contains the columns we want to return in our query.
                string[] projection = new[] { Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data };
                using (ICursor cursor = ManagedQuery(uri, projection, null, null, null))
                {
                    if (cursor != null)
                    {
                        int columnIndex = cursor.GetColumnIndexOrThrow(Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data);
                        cursor.MoveToFirst();
                        path = cursor.GetString(columnIndex);
                    }
                }
                return path;
            }
            #endregion

            protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
            {
                // For single image Selection
                if ((requestCode == PickImageId) && (resultCode == Result.Ok) && (data != null))
                {
                    Uri uri = data.Data;
                    _imageView.SetImageURI(uri);
                    path = GetPathToImage (uri);
                }
            }

 // Upload Image Button Click Event
Button btnUpload = FindViewById<Button> (Resource.Id.btnUploadImage);
btnUpload.Click += delegate {
                        System.Net.WebClient Client = new System.Net.WebClient();
                        Client.Headers.Add("Content-Type", "binary/octet-stream");
                        byte[] result = Client.UploadFile("http://192.168.1.50/Application_Name/upload.php", "POST", path);
                        string Result_msg = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
                        Toast.MakeText (this, Result_msg, ToastLength.Long).Show ();
                        _imageView.SetImageResource(0);
                    };

Here is my PHP Code on SERVER SIDE.

<?php
      $uploads_dir = 'uploads/'; //Directory to save the file that comes from client application.
      if ($_FILES["file"]["error"] == UPLOAD_ERR_OK)
      {
        $tmp_name = $_FILES["file"]["tmp_name"];
        $name = $_FILES["file"]["name"];
        $Result = move_uploaded_file($tmp_name, "$uploads_dir/$name");

        echo "Success: Picture Upload Successfully!";
      }
      else
      {
        echo "Error: Picture not Uploaded";
      }
?>

Waiting for your Reply.

'Android' does not exist in the namespace 'Xamarin.Forms.Platform"

$
0
0

I just upgraded VS Studio for Mac to 7.3 (build 199) and my Xamarin Forms Android project will no longer build.

Xamarin Forms iOS would only build after upgrading Xcode to 9.2 because it needed the new ios 11 headers.

But the Android project has 50 or more build errors and they all seem to be linked with the namespace Xamarin
Xamarin.Auth
Xamarin.Forms.Platform.Android

I've tried deleting the obj and bin folders, a clean and rebuild?

I'm at a lost since this is a 2 yr old solution that has been working previously.

Anyone know where I could start looking to diagnose or fix the problem?

Why isn't UIButton.TouchUpInside registering

$
0
0

I have my ViewController set up as follows. I realize that my button's parent view is probably not correct but i dont understand what I'm doing wrong. Why isnt the 'ActionCotainer' directly below 'PhotoContainer'. I could really use the help. Thanks.

`public class PhotoSelectView : UIViewController
{
protected UIView PhotoContainer { get; set; }
protected UIImageView PhotoView { get; set; }
protected UITextField PostIDLabel { get; set; }

    protected UIView ActionContainer { get; set; }
    protected UIButton likeButton { get; set; }
    protected UIButton chatButton { get; set; }

    nfloat screenWidth = UIScreen.MainScreen.Bounds.Size.Width;
    nfloat screenHeight = UIScreen.MainScreen.Bounds.Size.Height;
    UIImage DisplayImage;

    float buttonSize = 50;
    float photoLabelHeight = 50;
    float padding = 15;

    public PhotoSelectView(UIImage photoForPreview)
    {
        DisplayImage = photoForPreview;
    }

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        NavigationItem.Title = GlobalConfiguration.SelectedPhotoTitle;
        View.BackgroundColor = UIColor.White;

        //ADD Containers
        PhotoContainer = new UIView
        {
            AccessibilityLabel = "PhotoContainer",
            BackgroundColor = UIColor.White,
        };

        ActionContainer = new UIView
        {
            AccessibilityLabel = "ActionContainer",
            BackgroundColor = UIColor.Red,
            //ContentMode = UIViewContentMode.ScaleToFill
        };
        View.AddSubview(PhotoContainer);
        View.AddSubview(ActionContainer);

        //Add Container subviews
        PostIDLabel = new UITextField
        {
            VerticalAlignment = UIControlContentVerticalAlignment.Center,
            AccessibilityLabel = "PostID",
            BackgroundColor = UIColor.White,
            TextColor = UIColor.Black,
            Text = "POSTERS NAME WILL GO HERE",
        };

        PhotoView = new UIImageView
        {
            AccessibilityLabel = "PhotoPreview",
            BackgroundColor = UIColor.White,
            // RESIZE IMAGE BASED ON UIIMAGEVIEW SIZE
        };

        PhotoContainer.Add(PostIDLabel);
        PhotoContainer.Add(PhotoView);


        //LIKE BUTTON
        likeButton = new UIButton(UIButtonType.System);
        likeButton.Enabled = true;
        likeButton.SetImage(UIImage.FromBundle("ic_heart"), UIControlState.Normal);
        likeButton.Tag = 0;

        likeButton.TouchUpInside += (object sender, EventArgs e) =>
        {
            Console.WriteLine("liked");
            if (likeButton.Tag == 0)
            {
                likeButton.SetImage(UIImage.FromBundle("ic_heart_filled"), UIControlState.Normal);
                likeButton.Tag = 1;
            }
            else if (likeButton.Tag == 1)
            {
                likeButton.SetImage(UIImage.FromBundle("ic_heart"), UIControlState.Normal);
                likeButton.Tag = 0;
            }
        };

        //CHAT BUTTON
        chatButton = new UIButton(UIButtonType.System);
        chatButton.SetImage(UIImage.FromBundle("ic_chat"), UIControlState.Normal);

        chatButton.TouchUpInside += (object sender, EventArgs e) =>
        {
            Console.WriteLine("Lets Chat");
        };

        ActionContainer.Add(likeButton);
        ActionContainer.Add(chatButton);
    }

    public override void ViewDidLayoutSubviews()
    {
        base.ViewDidLayoutSubviews();

        PostIDLabel.Frame = new CGRect(0, 0, View.Bounds.Width, photoLabelHeight);

        PhotoView.Frame = new CGRect(0, photoLabelHeight, View.Bounds.Width, View.Bounds.Width);
        PhotoView.Image = DisplayImage;

        likeButton.Frame = new CGRect(0, photoLabelHeight + View.Bounds.Width, buttonSize, buttonSize);
        chatButton.Frame = new CGRect(buttonSize, photoLabelHeight + View.Bounds.Width, buttonSize, buttonSize);

        View.AddConstraints(
            PhotoContainer.AtTopOf(View),
            PhotoContainer.AtLeftOf(View),
            PhotoContainer.AtRightOf(View),

            ActionContainer.Below(PhotoContainer),
            ActionContainer.AtBottomOf(View),
            ActionContainer.AtLeftOf(View),
            ActionContainer.AtRightOf(View),

            PostIDLabel.AtTopOf(PhotoContainer),
            PostIDLabel.AtLeftOf(PhotoContainer),
            PostIDLabel.AtRightOf(PhotoContainer),

            PhotoView.Below(PostIDLabel),
            PhotoView.AtLeftOf(PhotoContainer),
            PhotoView.AtRightOf(PhotoContainer),

            likeButton.AtTopOf(ActionContainer, padding),
            likeButton.AtLeftOf(ActionContainer, padding),

            chatButton.AtTopOf(ActionContainer, padding),
            chatButton.AtLeftOf(likeButton, padding)
      );
    }
}`
Viewing all 204402 articles
Browse latest View live


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