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

How to implement responsive xamarin.controls.signaturepad.forms ?

$
0
0

In landscape mode signature is getting crop.so is there any way to implement signature pad in such a way that size of a signature does not crop in portrait or landscape?


Create ListView in Xamarin Android

$
0
0

Hello,

In this is blog I will show you how to make ListView in Xamarin Android.

Let’s Start.

Step -1

Open your Android solution in Xamarin Studio.

Step -2

Update your main.axml file inside your Resoursce/ Layout folder

<?xml version=“1.0” encoding=”utf-8″?>


Step -3

public class MainActivity: Activity {
string[] items;
ListView mainList;
protected override void OnCreate(Bundle bundle) {
base.OnCreate(bundle);
items = new string[] {
“Xamarin”,
“Android”,
“IOS”,
“Windows”,
“Xamarin-Native”,
“Xamarin-Forms”
};
// Set our view from the “main” layout resource
SetContentView(Resource.Layout.Main);
mainList = (ListView) FindViewById < ListView > (Resource.Id.mainlistview);
mainList.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, items);
}
}

Step -4

mainList.ItemClick += (s, e) => {
var t = items[e.Position];
Android.Widget.Toast.MakeText(this, t, Android.Widget.ToastLength.Long).Show();
};
Author : Hire xamarin developer ** | **xamarin development company

How to bind dynamically listview item source inside tabbed page?

$
0
0

I have multiple tabbed page created dynamically.so how to show single listview to all tabbed content page?

SignaturePad is showing Empty Panel on Android and No Canvas is showing to capture Signature

$
0
0

Hi,

I have installed SignaturePad.Forms nuget on PCL/ Platform specific projects, and SignaturePad nuget on Android/ iOS projects. However, SignaturePad is working fine on iOS, but not on Android as its not showing the Canvas panel it self and showing empty panel. When I was going through the references added in Android project, SignaturePad assembly is pointing to the assembly which is installed in ..\packages\Xamarin.Controls.SignaturePad.2.1.0\lib\Xamarin.iOS and not the MonoDroid assmebly.

This problem happens only when you want to use/install SignaturePad control on both iOS and Android platforms. And its only working on one platform and on others its just showing empty panel.

Please let me know the exact issue to correct it or fix it if its a nuget package issue.

Thanks,
Ramesh Majji

Listview button problem

$
0
0

I'm outputting data to a Listview on a page, for each item in the page I assign an 'Id' to a buttons command parameter, taken from a database (part of RModels). I'm trying to bind the button to call the command EditGSM but doesn't appear to do so. If i move the button code outside the Listview it triggers the command fine.

Content Page:
<ContentPage.BindingContext>

</ContentPage.BindingContext>

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="Logout" Command="{Binding LogoutCommand}" Clicked="Logout_Clicked" />
    </ContentPage.ToolbarItems>

    <StackLayout>
        <ListView ItemsSource="{Binding RModels}" HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout>
                            <Label Text="{Binding IMEI}" />
                            <Label Text="{Binding Description}" />
                            <Label Text="{Binding Model}" />
                            <Label Text="{Binding Created}" />
                            <Button Command="{Binding EditGSM}" CommandParameter="{Binding Id}" Text="Edit GSM" />
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>

ViewModel:

    public class GSMUnitsViewModel : INotifyPropertyChanged
    {
        ApiServices apiServices = new ApiServices();
        private List<GSMRegModelList> _rmodels;



        public GSMUnitsViewModel()
        {
            Task.Run(async () => RModels = await apiServices.GetGsmUnits(Settings.AccessToken));

        }

        public List<GSMRegModelList> RModels
        {
            get { return _rmodels; }
            set
            {
                _rmodels = value;
                OnPropertyChanged();
            }
        }


        public ICommand EditGSM
        {
            get
            {
                return new Command(() =>
                {
                    var test = "dfdf";
                });
            }
        }


        public ICommand LogoutCommand
        {
            get
            {
                return new Command(() =>
                {
                    Settings.AccessToken = "";
                    Settings.Username = "";
                    Settings.Password = "";
                });
            }

        }

        public event PropertyChangedEventHandler PropertyChanged;

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

    }

Azure AD B2C Authentication Trouble

$
0
0

I'm brand new to Xamarin (and mobile development). I'm trying to create a simple application that uses Azure AD B2C Authentication. I'm on Windows 10 Pro using Visual Studio 2017 Community Edition. I've followed the "Installing Xamarin in Visual Studio in Windows" setup guide. I created a brand new "Cross-Platform" Xamarin Forms application, and I've successfully gotten the template application to render on the Android emulator, iOS emulator, and Xamarin Live Player (though I did have to use the TestFlight version).

Next, I started to try and implement Azure AD B2C Authentication. I mostly followed the guide called "Integrate Azure AD B2C into a Xamarin forms app using MSAL". Apparently I can't post a link in these forums yet - but if you Google it, you'll see it. Here is where I'm running into trouble. If I download the sample application listed there in GitHub, I can follow the guide and get it running. So, I know that I've successfully set up everything in Azure. However, I have never been able to get it working in my brand new application.

Whenever I make a call to AcquireTokenAsync from within the function that handles the sign in button click, it hangs for a few seconds and then fails with the following error:

Java.Lang.NoSuchMethodError: No static method startActivity(Landroid/app/Activity;Landroid/content/Intent;Landroid/os/Bundle;)V in class Landroid/support/v4/app/ActivityCompat; or its super classes (declaration of 'android.support.v4.app.ActivityCompat' appears in /data/app/com.companyname.MobileClient-1/base.apk)

I've probably spent like 12 hours trying to figure this out on my own. I've tried updating versions of nuget packages, updating the Android stuff (platform, tools, etc...), copy/pasted code from lots of different places all over the internet... I just can't seem to figure it out. I think it's also important to point out that when Visual Studio provisions a brand new Xamarin project, it starts out with a bunch of warnings. They don't seem to impact the ability for the stock project to deploy, but maybe it's helpful to see them:

Warning NU1608 Detected package version outside of dependency constraint: Xamarin.Android.Support.CustomTabs 23.3.0 requires Xamarin.Android.Support.v4 (= 23.3.0) but version Xamarin.Android.Support.v4 25.4.0.2 was resolved.

Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. MobileClient.Android

Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.Android.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. MobileClient.Android

Warning The $(TargetFrameworkVersion) for FormsViewGroup.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. MobileClient.Android

I'm about at my wits end. I would happily just use the sample project that is working, but it's using an older version of Xamarin.Forms and a "Portable" library instead of .NET Standard. I'm not sure how important either of those things are (to be honest) but I don't want to set myself up for pain down the road.

Any help would be appreciated.

Method 'Android.Support.CustomTabs.CustomTabsIntent.LaunchUrl' not found.

$
0
0

Hi,

Experiencing exception in Azure B2C Directory login by using MSAL Library on Android platform with the following two libraries when updated to latest version (26.1.0.1)

Xamarin.Android.Support.CustomTabs (version 26.1.0.1)
Xamarin.Android.Support.v4 (version 26.1.0.1)
Please download sample from the following Link:

https://github.com/Azure-Samples/active-directory-b2c-android-native-msal

Exception:

System.MissingMethodException: Method 'Android.Support.CustomTabs.CustomTabsIntent.LaunchUrl' not found.

StackTrace:

MonoDroid( 7659): UNHANDLED EXCEPTION: MonoDroid( 7659): System.MissingMethodException: Method 'Android.Support.CustomTabs.CustomTabsIntent.LaunchUrl' not found. MonoDroid( 7659): at Android.App.Activity.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] :0 MonoDroid( 7659): at (wrapper dynamic-method) S An unhandled exception occured.

Microsoft.Identity.Client.MsalException : authentication_ui_failed

$
0
0

I want to use Azure AD B2C with Microsoft.Identity.Client. But when I call this AuthenticationResult ar = await App.PCA.AcquireTokenAsync(App.Scopes, App.UiParent); . I get error authentication_ui_failed .
Any ideas? I have been stuck here for 3 days now..


Microsoft Identity Client Error "An error occurred while sending the request"

$
0
0

Hello,
I want to make Azure AD B2C with theirs module Microsoft.Indetity.Client. But when I try to implement their sample. After I go through this line
" AuthenticationResult ar = await App.PCA.AcquireTokenAsync(App.Scopes, GetUserByPolicy(App.PCA.Users, App.PolicySignUpSignIn), App.UiParent);"
after a few seconds, I get the following error: "An error occurred while sending the request". What is wrong here? Does anyone have a clue?

I want to create following ui in forms. But I'm not able to do it being new to xamarin. Any help ??

Timer class in xamarin.forms

$
0
0

Hello

I'm making an application in xamarin.forms so that i can run on Android,iOS and windows mobile.

I'm in need of call a webservice after every 3 mins. Can you please tell me how can i do it ?

Please ask me questions if you need any more clarification.

Regards
TA

Access to scrollview in control template

$
0
0

In one of my views in code-behind, I want to call scrollView.ScrollToAsync. Unfortunately, my scrollview is defined in control template. How can I access it?

Geolocator Plugin

$
0
0

Hey. I am using Geolocator plugin. I try to use getposition inside of a timer with methods with async/wait and i get the result with await and not .result.
I have the right permissions in manifest but when i try to run the app she freezes in getpositionasync after 12 times getting location. Anyone know why ?

Labels always in the bottom right corner of the page

$
0
0

I've got the following problem: in one of my views I've got a scrollview and I want to have on the bottom right corner of the page two labels - one below another with the information about the last update of data. These labels should be always on the bottom right of the page, so when there is too much content and we scroll down labels are on the bottom right corner of the page. When there is a lot of space in a view these labels should be placed in the bottom right corner on the screen. How can I achieve that? When I was trying to achieve that using StackLayouts, the bottom label was cut off - I don't know why. Maybe I was doing sth wrong?

Newbie Needs help Xamarin.Forms, Native & backgrounding activities

$
0
0

Hi every one
I m not what we call a dev but i work with
We have an existing app developed on Xamarin Forms
Today we re facing a big issue: keep app alive in background till app killed by customer as for a GPS app
I ve found some documentation telling this is not a problem with Xamarin Native (ios and android)
Could you please confirm that point?
Second point if confirmed, is there any problem to use some Xamarin Native chunk of code in XamarinForms project?
I ve found some answer but I need you help to confirm those points befoire going further.

Many thanks for your help
BR


uwp close button is left

$
0
0

Hi
MainView.xaml in uwp opens but title is right and close button is left in title bar. Why?

How to convert WebView to Image?

$
0
0

How to convert WebView to Image and then save the image as a file(png,jpeg).

How to upload/download files from OneDrive in Xamarin Forms 3 App

$
0
0

I am developing an app with xamarin forms 3 where I need to upload and download files from OneDrive. I can't find any solution to this problem. I googled a lot but any solution based on Graph or Cloudrail API don't run. Is there ant good tutorial or code sample that solve this problem ? I can't believe that any others are in trouble like me. Thanks in advance to anyone can help me.

How to tell when the last row of a dxGrid:GridControl becomes visible?

$
0
0

With a GridControl, how can I trigger an event when the last row of the list becomes visible?

I'm using a GridControl to display a list of data and check boxes, and I want to trigger an event when the user scrolls down far enough for the last row of data to become visible, but I'm having trouble figuring out how to do it. Can someone please point me in the right direction? This is how I'm declaring my list:

<dxGrid:GridControl x:Name="dxDataList" ItemsSource="{Binding myDataList}">
      <dxGrid:GridControl.Columns>
          <dxGrid:SwitchColumn FieldName="bIsChecked" Caption="Completed"/>
          <dxGrid:TextColumn FieldName="CheckBoxText" Caption="Task"/>
      </dxGrid:GridControl.Columns>
</dxGrid:GridControl>

How to display alert form viewmodel

$
0
0
I want to display alert and navigate to next content page form viewmodel when i click my button command
I have also done view and viewmodel binding
Viewing all 89864 articles
Browse latest View live


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