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

Webview with URL scheme

$
0
0

Hi everyone, i'm new to the xamarin form, currently i trying to implement webview on my apps and implement successful.
But now i facing some issue regarding to the URL scheme error, is that possible implement URL scheme with webview?any references for better to implement?
thank you in advance.


Xamarin.Forms 3.1 error

$
0
0

After updating the Xamarin.Forms 3.0 to Xamarin.Forms 3.1 when I used

        xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
                android:TabbedPage.ToolbarPlacement="Bottom"
            android:TabbedPage.BarItemColor="#666666"
            android:TabbedPage.BarSelectedItemColor="Black"

I am getting this error.
Unhandled Exception:

System.TypeLoadException: Could not resolve type with token 01000029 (from typeref, class/assembly Xamarin.Forms.Xaml.XamlResourceIdAttribute, Xamarin.Forms.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) occurred

Popup Menu on bottom navigation option click

$
0
0

Hi,
In bottom navigation, I want to show popup menu with few menu options on one of the bottom navigation item clicked. Can anyone please help what should we use for it? The background should become blur.
Regards,
VS

How to programmatically set the color of Placeholder text of a disabled Entry on iOS

$
0
0

Can anybody tell me please how to specify the color of the placeholder for an Entry that is disabled on iOS? (Android and UWP are sorted).

I know I can workaround it by placing another View over the top of the Entry, but it would be useful to do it "properly" in a custom Entry renderer.

How to handle NavigationBar(Software) back button click event.

$
0
0

Hello,
I want to implement NavigationBar(Software) back button event in my xamarin forms app. So is there any way to do that?
I have tried by overriding OnBackButtonPressed method but it is only working with Hardware back button.

Null-safe binding to a nested property

$
0
0

I have a binding like this:

var nameLabel = new Label();
nameLabel.SetBinding(
  Label.TextProperty,
  new Binding("Item.Location.PathElement.Name",
              BindingMode.Default,
              new Null2DefaultConverter(s_DefaultValueNoPath)));

The problem is that all levels of the sub-properties of Item can be null. In my case, the PathElement property returns null. Currently that causes the binding to fail completely, so that my converter is not called. Changing the path to "Item.Location?.PathElement?.Name" did not help either.

In WPF XAML there are 2 mechanisms in the Binding class that handle nulls and errors:

  • TargetNullValue provides a default value if the value is successfully retrieved but was null (in my example Name is null)
  • FallbackValue provides a default value if the value could not be retrieved (e. g. if any property "before" Name was null already)

How can I make the Xamarin binding assume null as value when any part of the nested property path is null?

Show a display popup for update when update available from playstore

$
0
0

I want to show a display popup for update apk(if update available from playstore)when user open the application.If user click on "OK" then it will open the playstore for update apk.
How to do this in xamarin forms?

IOS Build failed, MT5209 : "Native linking error : framework not found Carbon"

$
0
0

This only happen on osx when i tried to build the ios part of the project, android built just fine.

clang : error : linker command failed with exit code 1 (use -v to see invocation)
error MT5209 : Native linking error : framework not found Carbon
MTOUCH : error MT5202: Native linking failed. Please review the build log.

I'm on xamarin.forms 3.2.0.637442-pre1. Linking set to "None".

Here is the full build log attatched.


How can I remove the white space if a entry or Label is hide? Please help me!

$
0
0

I need to remove white space while a entry or label is hide ?

Attached image with blank space enclosed in red

How to change the image if Image URI is same even with different image?

$
0
0

Hello,

I am using following code for Carousel view. I have images where if user change the image, it keeps WebURI same. Following is UI flow.
1- User go to profile
2- From profile, user have option to go to images page where user can add images. When user add the image, it save to server with same WebURI.
3- Now, user come back to Profile page. Here it shows same image even I recall the API on Appearing of the page and add the Pictures again.

Actually I am using FFImageLoading but I have tried with simple Image control as well.

With FFImageLoading

<StackLayout Orientation="Vertical" VerticalOptions="Center">
  <forms:CarouselView x:Name="MainCarosel" ItemsSource="{Binding Pictures}"  Position="{Binding Position}" IsVisible="{Binding IsImageVisible}" RelativeLayout.WidthConstraint=
    "{ConstraintExpression Type=RelativeToParent, Property=Width}" HeightRequest="375">
    <forms:CarouselView.ItemTemplate>
      <DataTemplate>
        <ff:CachedImage Source="{Binding .}" CacheDuration="0" Aspect="AspectFill" RelativeLayout.WidthConstraint=
    "{ConstraintExpression Type=RelativeToParent, Property=Width}" HeightRequest="375">
        </ff:CachedImage>
      </DataTemplate>
    </forms:CarouselView.ItemTemplate>
  </forms:CarouselView>
  <local:CarouselIndicators IsVisible="{Binding IsImageIndicatorVisible}" Margin="0,-30,0,0" IndicatorHeight="8" IndicatorWidth="8" UnselectedIndicator="icon_dot_off" SelectedIndicator="icon_dot_on" Position="{Binding Position}" ItemsSource="{Binding Pictures}" />
</StackLayout>

With simple Image

<StackLayout Orientation="Vertical" VerticalOptions="Center">
  <forms:CarouselView x:Name="MainCarosel" ItemsSource="{Binding Pictures}"  Position="{Binding Position}" IsVisible="{Binding IsImageVisible}" RelativeLayout.WidthConstraint=
    "{ConstraintExpression Type=RelativeToParent, Property=Width}" HeightRequest="375">
    <forms:CarouselView.ItemTemplate>
      <DataTemplate>
        <Image Aspect="AspectFill" RelativeLayout.WidthConstraint=
    "{ConstraintExpression Type=RelativeToParent, Property=Width}" HeightRequest="375">
          <Image.Source>
            <UriImageSource Uri="{Binding .}"
              CachingEnabled="false"/>
          </Image.Source>
        </Image>
      </DataTemplate>
    </forms:CarouselView.ItemTemplate>
  </forms:CarouselView>
  <local:CarouselIndicators IsVisible="{Binding IsImageIndicatorVisible}" Margin="0,-30,0,0" IndicatorHeight="8" IndicatorWidth="8" UnselectedIndicator="icon_dot_off" SelectedIndicator="icon_dot_on" Position="{Binding Position}" ItemsSource="{Binding Pictures}" />
</StackLayout>

ViewModel

public async Task Appearing()
{
    await getAllData();
}   

private async Task getAllData()
{
    ProfileData Profile =  GetProfile(); //API Call
    Pictures = new List<string>();
    //One Way binding with control
    Pictures = Profile.Pictures.Select(t => t.Value).ToList();  
}

What event do I need to make the verticle scrollbar visible?

$
0
0

I have my custom renderer for the ListView control and the intention is that the scrollbar is always displayed.
According to the Android documention this can be done;
https://developer.android.com/reference/android/view/View#setVerticalScrollBarEnabled(boolean)
However my custom control does not do this as intended. The Scrollbar behaves as before, not visible unless a ListView item is selected.
What am I doing wrong?

                <c:ListViewScrollBar ItemsSource="{Binding PropertyList}">
                    <c:ListViewScrollBar.Behaviors>
                        <b:EventToCommandBehavior Command="{Binding ItemTappedCommand}"
                                                  EventName="ItemTapped"
                                                  EventArgsParameterPath="Item" />
                    </c:ListViewScrollBar.Behaviors>
                    <c:ListViewScrollBar.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <ContentView  Padding="3">
                                    <Label Text="{Binding FullAddress}" BackgroundColor="blue" TextColor="White" FontSize="7"
                                           VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
                                </ContentView>
                            </ViewCell>
                        </DataTemplate>
                    </c:ListViewScrollBar.ItemTemplate>
                </c:ListViewScrollBar>
using Xamarin.Forms;

namespace Sir.Mobile.CustomRenderers
{
    public class ListViewScrollBar : ListView
    {
        public ListViewScrollBar()
        {
        }
    }
}

using Android.Content;
using Sir.Mobile.CustomRenderers;
using Sir.Mobile.Droid.CustomRenderers;
using System.ComponentModel;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(ListViewScrollBar), typeof(ListViewScrollBarRenderer))]

namespace Sir.Mobile.Droid.CustomRenderers
{
    /// <inheritdoc />
    public class ListViewScrollBarRenderer : ListViewRenderer
    {
        public ListViewScrollBarRenderer(Context context) : base(context)
        {
        }

        protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.VerticalScrollBarEnabled = true;
            }
        }

        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);
            if (Control != null)
            {
                Control.VerticalScrollBarEnabled = true;
            }
        }
    }
}

Is it meant to be possible to remain on a pcl and target Xamarin Forms 3?

$
0
0

According to the RC release summary it was meant to be possible to remain on a PCL (as opposed to migrating to .net standard).

We’re now building with .NET Standard 2.0, using the magic of multi-targeting, while still supporting the PCL profiles and other .NET Standard versions you may need. Notice how much faster your projects load when you use .NET Standard project types! from blog.xamarin update-to-xamarin-forms-3-0-pre-release-available-today

I have tried this but attempting to upgrade to xf 3 yields the error:

Package Xamarin.Forms.Pages 3.1.0.697729 is not compatible with portable46-net451+win81 (.NETPortable,Version=v4.6,Profile=Profile44). Package Xamarin.Forms.Pages 3.1.0.697729 supports: netstandard2.0 (.NETStandard,Version=v2.0)

Hii, I want to execute only mock database not "main", when i am running unit tests

$
0
0

Can i execute only mock database when i am running the unit tests

Incorrect permission status on Android For Xamarin Forms

$
0
0

The plugin returns Denied on Android when you haven't even asked the user for the permission. The same situation on iOS returns Unknown, which makes more sense.

var status = await CrossPermissions.Current.CheckPermissionStatusAsync(permissions);

here status is Denied in Android in initial state while in iOS it return Unknown

Grouped Listview overlapping with bottom navigation bar for iOS?

$
0
0

I have a bottom navigation bar (Tabbed Page) with four 4 tabs, the 4th tab has navigation page which will navigate to other pages.
The 4th tab is having grouped listview which will navigate to other pages and again if I click on the 4th tab from child pages of 4th Tab will navigate to the Top page (which is grouped list page) making the problem. If I click other Tabs and come back to 4th Tab is not creating the problem.
If I coming back to the 4th tab (grouped listview page) from child page of list page the last 2 items are not able to click. Here my assumption is the bottom tab bar is overlapping with listview while coming back from the child page.
But if I come back from the main tabs it is working fine. And this is occurring for iOS only Android is working fine.
Can anybody help me out to fix this issue?


Incorrect permission status on Android For Xamarin Forms

$
0
0

The plugin returns Denied on Android when you haven't even asked the user for the permission. The same situation on iOS returns Unknown, which makes more sense.

var status = await CrossPermissions.Current.CheckPermissionStatusAsync(permissions);

here status is Denied in Android in initial state while in iOS it return Unknown

what is your experience with IAP plugin for Android? Something doesnt seem to be correct for me!

$
0
0

I think that we all use https://github.com/jamesmontemagno/InAppBillingPlugin for Android and IOS. I havent implemented IOS indeed but on Android, I am disturbed about in app purchase implementation. I dont know about if that is the way it is for Google or it is the problem with the plugin. I have also seen issues created for that bu they are closed without solution.
When I check my app center logs, I am seeing more than 50% even though 70% probably in app purchase attempts are failing. here are 2 messages,
- You are not connected to the Google Play App store.
- Unable to process purchase.

It was said that if user is not connected to google play store or if user doesnt have a valid gmail for purchase, you get either of these messages. I mean that I cant believe it, because everybody is using his/her android with gmail. in order to download an app, you need to be connected with gmail. I know that if there is no payment method attached, it also throws this exception. But it cant be google doing this by design.
I have experience with UWP and Microsoft will show a popup for user to enter email address and password to login in such case.
Can somebody bring some experience either from xamarin forms or xamarin android native?

Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter

$
0
0

I don't know why I am getting this error. I am using MVVM and a listview. What I am trying to use is that I am fetching some info from Backend with the help of MVVM. I want that my listview should be updated when I am adding an item. Everything is working fine except the listview, neither it is updated nor unable to remove an item.

Here is my code

List<string> items = new List<string>();
    ObservableCollection<UserCartDetails> cart_response = new ObservableCollection<UserCartDetails>();
    ShoppingServices shoppingServices = new ShoppingServices();
    //UserCartDetails Item = new UserCartDetails();
    public static Context _context = Android.App.Application.Context;

#region "Refreshing Data"
    private bool isLoading;
    private bool isRefreshing;
    public bool IsLoading
    {
        get
        {
            return this.isLoading;
        }

        set
        {
            this.isLoading = value;
            RaisePropertyChanged("IsLoading");
        }
    }
    public bool IsRefreshing
    {
        get
        {
            return this.isRefreshing;
        }

        set
        {
            this.isRefreshing = value;
            RaisePropertyChanged("IsRefreshing");
        }
    }
    public event PropertyChangedEventHandler PropertyChanged;

    public void RaisePropertyChanged(string propName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }
    }
    public Command RefreshCommand
    {
        get
        {
            return new Command(async () =>
            {
                await BindData();
            });
        }
    }
    #endregion

private async Task BindData()
    {
        //cart_response.Clear();
        var response1 = shoppingServices.GetCartDetail(BaseClass.UserId, BaseClass.Kitchen_Id, BaseClass.Token);
        if (response1.success == "True")
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                cart_response = response1.parameters;
                ResponseList.ItemsSource = cart_response;
            });
           // cart_response = response1.parameters;

        }

        IsLoading = false;
        IsRefreshing = false;
    }
    private async void Button_Click(object sender, EventArgs e)
    {
        IsLoading = true;
        data.IsVisible = true;
        string name = entry_name.Text;
        string quantity = WeightList.SelectedItem.ToString().Split(' ')[0];
        var response = shoppingServices.CartDetail(BaseClass.UserId, BaseClass.Kitchen_Id, name, quantity, BaseClass.Token);
        if (response.success == "True")
        {
            await Task.Run(async () => { await BindData(); });
            //await BindData();
        }
    }
    void OnTapGestureRecognizerTapped2(object sender, EventArgs e)
    {
        //var item = (Xamarin.Forms.Image)sender;
        int cart_id = Convert.ToInt32(((Xamarin.Forms.TappedEventArgs)e).Parameter);
        var response = shoppingServices.RemoveCartDetail(BaseClass.UserId, cart_id.ToString(), BaseClass.Token);
        if (response.success == "True")
        {
            Toast.MakeText(_context, response.message, ToastLength.Long).Show();
            cart_response.Clear();
            ResponseList.ItemsSource = cart_response;
            if(ResponseList.ItemsSource==null)
            {
                ResponseList.IsVisible = false;
            }
            else
            {
                var response1 = shoppingServices.GetCartDetail(BaseClass.UserId, BaseClass.Kitchen_Id, BaseClass.Token);
                if (response1.success == "True")
                {
                    cart_response = response1.parameters;
                    ResponseList.ItemsSource = cart_response;
                }
            }
        }
        else
        {
            Toast.MakeText(_context, response.message, ToastLength.Long).Show();
        }
    }

On a UWP build running on Windows desktop, how can the user hit the navigate back button using kbd?

$
0
0

On a UWP build running on a Windows desktop, the navigate back button appears at the top left of the window (effectively where the System Menu would drop down from in a traditional cmd window). For a keyboard-only user, how does the user hit that button? It doesn't seem to be on the tab order.

The SignUp Page don't work in other phone , the App crashes ?

$
0
0

Hello guys ...The app works perfectly in my phone when I debug from visual studio , but when I got the APK and tested in other phone , the app crashed when I clicked to open the SignUp Page ??
I have no error in Visual Studio , what can the problem be ?

Viewing all 77050 articles
Browse latest View live


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