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

Portrait upside down screen orientation doesn't work in Xamarin.Forms!


How to select multiple images from gallery from both android and iOS device?

$
0
0

Hello,
I am working on xamarin.forms app. I am creating the app for android and iOS. I need to open the gallery and select multiple images from gallery of devices. How I can do this in xamarin.forms that can work for both android and iOS?

Regards,
Anand Dubey

How to convert AlertDialog to Snackbar?

$
0
0

I have the following in my Xamarin.Forms project:

`if (ShouldShowRequestPermissionRationale(permission))
{
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.SetTitle("Location permission needed");
alert.SetPositiveButton("Allow", (senderAlert, args) =>
{
RequestPermissions(PermissionsGroupLocation, RequestLocationId);
});

            alert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                Toast.MakeText(this, "Cancelled", ToastLength.Short).Show();
            });

            Dialog dialog = alert.Create();
            dialog.Show();


            return;
        }`

I'd like to make it into a snackbar so it doesn't block the main page and dismisses itself after a few seconds

The main problem is that Snackbar.Make() takes a view as its first parameter but I'm using Xamarin Forms

Xamarin.Forms with Firebase.Xamarin

$
0
0

Hello,

I am trying to use Firebase plugin provided by rlamasb (github.com/rlamasb/Firebase.Xamarin) in my Xamarin.Forms project using VS2017. However, the moment I include the nuget package in my shared project, I get following error:

  1. NU1202 Package Firebase.Xamarin 0.3.6 is not compatible with xamarinios10 (Xamarin.iOS,Version=v1.0) / win-x64. Package Firebase.Xamarin 0.3.6 supports: net (.NETFramework,Version=v0.0)
  2. NU1202 Package Firebase.Xamarin 0.3.6 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Firebase.Xamarin 0.3.6 supports: net (.NETFramework,Version=v0.0)

Could anybody please guide me to get started with it?

Thank you.

Change the masterpage menu

$
0
0

how to change the menu upon logged in of the user

make a custom keyboard

$
0
0

Hello.
is possible to do a keyboard to cross platforms as like the photo ?
I asking for complete DNI.!

Certain FontAwesome fonts not displaying

$
0
0

I installed the latest font-awesome fonts into my xamarin.forms shared project (targeting Android only). I followed the instructions here:

https://www.wintellect.com/using-fontawesome5-xamarin-forms/

However, I notice that not all the fonts will display on my forms. E.g. fa-eye will display correctly, but fa-vial displays nothing. E.g.

<Label Text="&#xf492;" TextColor="Black" FontSize="Large">
  <Label.FontFamily>
    <OnPlatform x:TypeArguments="x:String" Android="fa-regular-400.ttf#Font Awesome 5 Free Regular" />
  </Label.FontFamily>
</Label>

The above example should display the fa-vial font icon, but nothing is shown. If I change the Text to &#xf06e then the fa-eye font icon is correctly displayed.

Asking permission for location when a specific page is opened (PCL)

$
0
0

I have my permission request setup in Android's mainactivity, and if you have location disabled and open the app, it will request location. It's a bit tedious and I'd like it to only request for permission when you open a specific content page.

I have my xaml content page in my PCL. Right now, in my Android mainactivity, I put await GetPermissionsAsync in OnCreate().


How to customize rating bar size in xamarin forms

$
0
0

I used This XFControls plugin to create Rating bar in my app but This bar is too large in phones and i want to customize its size
I tried witdth request but it didn't work for me

xmlns:Rating="clr-namespace:AsNum.XFControls;assembly=AsNum.XFControls"

my xaml

     <Rating:RatingBar BackgroundColor="SeaGreen"

                                        StarCount="5" Step="0.5"  SelectedColor="Orange"
                                                       HeightRequest="40" HorizontalOptions="Fill" UnSelectedColor="LightGray" Rate="{Binding Rating,Mode=TwoWay}">

                                        </Rating:RatingBar>

how can i do that ?

How can we support RTL with Xamarin.Forms embedding into Xamarin Native?

$
0
0

My Native Xamarin App supports ltr and rtl. I embedded a Forms page to my Native Project. Now how can I support rtl to Forms pages too?

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

Xamarin Web Service Example ?

$
0
0

Hi developers, I have a web service in asp.net I have developed using asmx. How can I use this xamarin ?

I could do things like get post delete delete edit using asmx I would like to do this in xamarin.

Sample asmx url = mavidemlik.teslayazilim.com/get.asmx

Override Back button behaviour WITHOUT stopping navigation

$
0
0

So what I'm trying to do might not be possible, but maybe someone knows a nifty hack or work-a-round...

What I'd like to do is override the Android Back button so that instead of destroying the activity, it sends it to the background with the "MoveTaskToBack()" function.

Seems simple enough BUT...

I'd like to leave the navigation behaviour alone as well as any other handling of the back button (i.e. On a Tabbed page, the back button changes the page to one index back). The problem as the event used to invoke the changes in Xamarin.Forms is located in the base class AppCompatActivity, and there is no function call to raise this event.

So if I override the OnBackPressed I lose the ability to let Xamarin.Forms handle back events, but if I don't override it then I get an undesirable behaviour when Forms is done handling the back button.

Using an object in Resource Dictionary

$
0
0
<Frame BorderColor="#002e50" CornerRadius="0" HorizontalOptions="FillAndExpand" HasShadow="False">
                        <Frame.Content>
                            <StackLayout>
                                <abstractions:SvgImage SvgAssembly="{Binding SvgAssembly}" SvgPath="{Binding Something}" HorizontalOptions="Center" WidthRequest="30" HeightRequest="30" />
                                <Label Text="Some text" TextColor="#002e50" />
                            </StackLayout>
                        </Frame.Content>
                    </Frame>

I want to use something like an above code in Application Resource Dictionary and use on all the pages of my app. How can i achieve this.

Thank you

Custom TabbedRenderer to set tab text color on Android

$
0
0

I found an iOS render:

but I can't seem to find a similar Android rendered to set to set the tab text color. I found a bunch of posts that reference things like background color:

but nothing for tab text color.

// http://forums.xamarin.com/discussion/comment/80381/#Comment_80381       
public class CustomTabRenderer : TabbedRenderer
{
    private Activity activity;
    private bool isFirstDesign = true;

    protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);
        activity = this.Context as Activity;
    }

    protected override void OnWindowVisibilityChanged(ViewStates visibility)
    {
        base.OnWindowVisibilityChanged(visibility);
        if (isFirstDesign)
        {
            ActionBar actionBar = activity.ActionBar;

            ColorDrawable colorDrawable = new ColorDrawable(Color.White);
            actionBar.SetStackedBackgroundDrawable(colorDrawable);

            // TODO: set tab text color

            isFirstDesign = false; 
        }
    }
}

rotation messes up label

$
0
0

I have a

I have tried playing around with xaml, but the label just keeps getting truncated. Makes no sense.

Years ago I did some Windows CE and Windows Mobile development. Really nice platforms to work on, logical and well thought out.

Xamarin.Forms not working properly on some android devices.

$
0
0

I'm creating xamarin.forms app. I've written a background service in android project which runs after every two minutes (with the help of broadcast receiver).
And I'm calling that service from portable project using dependency service.
This app runs correctly on some phones, but fails on some phones at the point where that background service is getting called.
Can anyone please help me finding the solution to this strange problem ???

Thanks in advance :smile:

How to bind Viewmodel to CustomeUserControl using MvxViewModel in MVVMCross?

$
0
0

Hello All,

After a long, while I am back in Xamarin development.
I have query about how to implement data/command binding to customeusercontrol using MvxViewModel in MvvmCross.

Please help me out if any solution.

Problem with Firebase Analytics (Android) on Xamarin.Forms

$
0
0

Hi,

I am trying to implement Firebase Analytics in my Android project in Xamarin Forms...

My Dependency:

using System;
using Android.Content;
using Xamarin.Forms;
using Firebase.Analytics;
using Firebase.Crash;
using Android.OS;

[assembly: Dependency(typeof(ConvertAny.Droid.FirebaseService))]
namespace ConvertAny.Droid
{
    public class FirebaseService : IFirebaseService
    {
        FirebaseAnalytics firebaseAnalytics;

        public void Track_App_Page(String PageNameToTrack)
        {
            var bundle = new Bundle();
            bundle.PutString(FirebaseAnalytics.Param.ItemId, "1");
            bundle.PutString(FirebaseAnalytics.Param.ItemName, PageNameToTrack);

            firebaseAnalytics.LogEvent(FirebaseAnalytics.Event.SelectContent, bundle);
        }
    }
}

In MainActivity:

FirebaseAnalytics firebaseAnalytics;

protected override void OnCreate(Bundle bundle)
{
    TabLayoutResource = Resource.Layout.Tabbar;
    ToolbarResource = Resource.Layout.Toolbar;

    base.OnCreate(bundle);

    global::Xamarin.Forms.Forms.Init(this, bundle);

    firebaseAnalytics = FirebaseAnalytics.GetInstance(this);
    ...........
    ...........
    ...........

In my Home.xaml.cs:

FirebaseDependencyService.Track_App_Page("Pages - Home");

But I am getting:

Object reference not set to an instance of an object.

On this line:

firebaseAnalytics.LogEvent(FirebaseAnalytics.Event.SelectContent, bundle);

Can anyone help please

Thanks,
Jassim

How to intercept Navigation Bar Back Button Clicked in Xamarin Forms?

$
0
0

I have a xamarin forms page where the user can update some data in a form. I need to intercept the Navigation Bar Back Button Clicked to warn the user if some data have not been saved.How to do it?

I'm able to intercept the hardware Bar Back Button Clicked in Android using the Android.MainActivity.OnBackPressed(), but that event is raised only on hardware Bar Back Button Clicked, not on Navigation Bar Back Button Clicked.

I tried also to override Xamarin.Forms.NavigationPageOnBackButtonPressed() but it not works. Why? Any one have already solved that issue?

I also tried by overriding OnDisappear, there are two problems:

The page has already visually disappeared so the "Are you sure?" dialog appears over the previous page.
Cannot cancel the back action.
So,is it possible to intercept the navigation bar back button press?

Thanks for any help on this.

Viewing all 91519 articles
Browse latest View live


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