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

is there a Tabbed view in Xamarin.forms?

$
0
0

Hello,
any idea how to make a Tabbed view in xamarin.forms,
i only found Tabbed page which is not possible to put it inside a content page!

choosing Xamarin.forms is bad choice? should i've used each platforme beside with xamarin.android and xamarin.ios!

Thanks in advance


Log in problem

$
0
0

How to tell the slide-in menu of masterdetailpage that the user has logged in? I mean how to make slide-in menu of masterdetailpage display the user has logged in

Code MSB4062

$
0
0

Hi Xamarin Forum,
I notice one thing when I update my Xamarin.Forms to 3.0.0.446417 in VS 2017 when I start a new project either .Net or shared I immediately got the error MSB4062 The "Xamarin.Forms.Build.Tasks.XamlGTask" task could not be loaded from the assembly. Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

So how can I fix this?
Thank you

How to draw a circle on Map?

$
0
0

Hi everybody!
I have follow Circular Map Overlay (Sample) to draw a circle of a location on map.
But it's only draw one time when Map is render. I want to draw another circle when I choose a location on Map.
How to call draw circle method inside every CustomRender file?
If you have another way to draw a circle when tap on Map, Please suggest me!
Thank you!

How to remove a tab dynamically

$
0
0

I have this tabbedpage:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
            prism:ViewModelLocator.AutowireViewModel="True"
            x:Class="AppAlgorix.Views.TabbedDescriptionPage"
            xmlns:local="clr-namespace:AppAlgorix.Views"
            Title="Detalhes do Cartão">
    <TabbedPage.Children>
        <local:InvoicesPage Title="Faturas" Icon="ic_attach_money_white_18dp.png" IsVisible="{Binding InvoicesVisible}" />
        <local:LastEntriesPage Title="Lançamentos" Icon="ic_view_list_white_18dp.png" IsVisible="{Binding LastEntriesVisible}" />
        <local:PointsPage Title="Pontos" Icon="ic_numeric_white_18dp.png" IsVisible="{Binding PointsVisible}" />
    </TabbedPage.Children>
</TabbedPage>

Sometimes I will need to turns invisible the second and third tabs.

I tried to get the event OnNavigatedTo, but I saw its never fired in tabbed page.

I need to remove one tab or another, before the user sees the tabbed page as well.

There is the attribute IsVisible on each child page, so I think is possible to turns a tab invisible programatically, but I dont know how...

How to do that ?

Thanks.

How to change Label

$
0
0

Hi xamarin community may I ask for your help how can I change my Label "logged out" to "logged in" upon logging in using masterdetailpage

Invalid number of rows in section

$
0
0

I trying to bind a ListView with an ObservableCollection. It works on both Windows Phone and Android but when running it on iOS I get an exception. The message says:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (130) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

 public partial class TransfersView : ContentPage
     {
         public TransfersView(TransfersViewModel model)
         {
             InitializeComponent();

             BindingContext = model;  
         }
     }


  <ListView x:Name="Transfers" ItemsSource="{Binding Transfers}">
     <ListView.ItemTemplate>
       <DataTemplate>
         <TextCell Text="{Binding Player}" />
       </DataTemplate>
     </ListView.ItemTemplate>
   </ListView>

Does anyone has a solution?

How to size things in a StackLayout?

$
0
0

I wrote a simple stack layout with an Image control:

    public partial class LoginPage : ContentPage
    {   
        public LoginPage ()
        {
            InitializeComponent ();

            var img = new Image { Source = "imagenamge.png", Aspect = Aspect.AspectFit, Scale = 0.75 };
            var eUser = new Entry { Placeholder = "User Name" };
            var ePass = new Entry { Placeholder = "Password", IsPassword = true };

            var lSave = new Label { Text = "Save User Name and Password", YAlign = TextAlignment.Center };
            var sSave = new Switch();
            var switchLayout = new StackLayout { Orientation = StackOrientation.Horizontal };
            switchLayout.Children.Add( lSave );
            switchLayout.Children.Add( sSave );

            var bLogin = new Button { Text = "Log In" };
            var bSet = new Button { Text = "Settings" };

            var layout = new StackLayout 
            { 
                Children = 
                { 
                        img,
                        eUser,
                        ePass,
                        switchLayout,
                        bLogin,
                        bSet
                },

                Padding = 10

            }; // end new StackLayout

            Content = layout;
        }

    }

This works fine...if I use the 4" iPhone simulator. if I use the 3.5" iPhone simulator, everything below the image gets overlapped. The image is visible, though it does have a rather large border around it (this happens on both simulators). Before I put the Scale property in, the image just filled the available space. Anyway, on the 3.5" screen the two Entry fields are fine, but the label gets vertically chopped (you see the middle section of all the text, with the tops and bottoms of letters cut off), the Switch is visible because it is off to the side, but is hard to use because the Log In button is right smack up against the bottom of it. The Settings button appears to be spaced below the Log In button at the same distance as in the 4" view, thus taking up way more space than it needs to as well.

Now, I bet I could fix this if I could somehow tell the image field how big it should be, or perhaps a percentage of the rest of the items in the stack view. Is there any way to do this? Is there any way to size any field in a StackLayout?

Thanks.


Implementing Push notifications in Xamarin Forms

$
0
0

Hello, I am working in xamarin forms for developing app from past few months, I need to implement push notifications in my app where user will be notified as any changes occurs in server database, but I am not getting proper reference anywhere for setting push notifications from web services to mobile in cross platform manner. Can anyone help me with reference links or any samples for implementing push notifications in xamarin.forms app?

Getting error: package android.views does not exist

$
0
0

Recently upgrade to Visual Studio 15.7.2 and I started getting a bunch of javac errors, most of them:
error: package android.views does not exist
There are a couple other packages missing, and then some items that are missing because I think others are failing.
Problem is I don't know what these packages are, or where they are supposed to be/

A couple of blogs/stackoverflow answers suggested deleting .../appdata/local/xamarin/xamarin.* (or android.*)
I don't know if 2017 uses these files anymore.
I've also tried to uninstall and reinstall.

The code should be fine, as it builds on my dev machine. But it fails on the build machine. (On my dev machine, I removed the aforementioned files in the xamarin directory, and they don't come back. Which leads me to believe they are no longer used)

We normally use msbuild to build, but it fails under visual studio as well.
We build by first copying the code down from our source control, so there are no build files lying around, so a clean and/or restarting visual studios won't help. And the nuget packages are also fresh.

The SDK of the build machine is very similar to the SDK on my dev machine (a few of the minor versions are different)
These branches also used to build on the build machine as well.

We are building against Oreo 8.0, using Xamarin Forms 2.5 (this all started when I tried to upgrade to 3.0, but I've since backed out the 3.0 changes)
JDK 1.8.0_161

there has to be something missing or corrupt on my build machine, I just can't figure out what it is.

I tried to reinstall VS 15.6.7 (this is the latest I could rollback to)
This time a the files in ../appdata/local/xamarin were restored. But it didn't help. I'm still getting the same errors.

How to read file from Downloads Folder in Android and bind the file to webView

$
0
0

Hi Guys,
I have a problem in binding pdf file to web view source. Assume that i have downloaded file from web api and saved in downloads folder in android trying to read the downloaded file from folder. Here im able to open downloaded file in external apps like Adobe reader but need to open same in web view. Help me Out Guys.

Thanks In Advance.

Frame Outline Color did Not Work in Xamarin.Android

$
0
0

Hi,
How to set a frame outline color for Android in xamarin forms?.Please Let Me Know If Anyone To know How To Solve this error.

Authentification Xamarin + Web Site

$
0
0

Hi everyone,

I'm new and i have to develop a Xamarin Forms cross platform application.

There is a Web Site of this application (I didn't create it), and the authentication's system is generated by Asp.Net Identity.

For my mobile application i use a WebAPI with controllers to build HTTP services, I'm connecting to a SQL Database.

I read multiple time (or I misunderstood), that Xamarin Forms can not use Identity to authenticate users.

So first question : There is no way to use the provider ?

Second question : If I have to change the method in the Web Site, what can I use as method wich works for Xamarin + Web Site please ?

Can't create Effect on iOS Xamarin.Forms 3.0.0.482510

$
0
0

Hello,

i made a Tutorial from the eShopOnContainers eBook.
The tutorial has a subject on adding an Effect to an Entry (EntryLineColorEffect).
The whole thing worked fine until Xamarin 3.0.0.482510 came out. Since this
Version the App crashes in the Class LineColorBehavior.cs when creating an Instance of the EntryLineColorEffect(see below).
private static void OnApplyLineColorChanged(BindableObject bindable, object oldValue, object newValue)

 ''   {
        logger.Debug("OnApplyLineCOlorChanged");
        var view = bindable as View;

        if (view == null)
        {
            return;
        }

        bool hasLine = (bool)newValue;

        if (hasLine)
        {
            logger.Debug("Add EntryLineColorEffect");
            var entryLineColorEffect = new EntryLineColorEffect();
            view.Effects.Add(entryLineColorEffect);

            logger.Debug("Added EntryLineColorEffect");
        }
        else
        {
            var entryLineColorEffectToRemove = view.Effects.FirstOrDefault(e => e is EntryLineColorEffect);
            if (entryLineColorEffectToRemove != null)
            {
                view.Effects.Remove(entryLineColorEffectToRemove);
            }
        }
 ''   }

The EntryLineColorEffect class looks like that on the main Project:
public class EntryLineColorEffect : RoutingEffect
{
public EntryLineColorEffect() : base("MyProject.EntryLineColorEffect")
{
}
}
And is implemented in the particular plattform projects.
On Android everything works like before but on iOS the App stops without any hints.

The app has been terminated.
Failed to Stop app: An error occured on client IDB4100442 while executing a reply for topic xvs/idb/4.10.0.442/stop-app
The app has been terminated.

Changing navigation bar title when inside a tabbed page.

$
0
0

Hi, I am a xamarin.forms beginner, just wondering how can I change navigation bar's title when its in tabbed page? code as following :

public TabbedPageDemoPage() { Children.Add(new PageA() { Title = "PageA_tabbutton_text", Icon = "pageA_icon.png" }); Children.Add(new PageB() { Title = "PageB_tabbutton_text", Icon = "pageB_icon.png" }); Children.Add(new PageC() { Title = "PageC_tabbutton_text", Icon = "pageC_icon.png" }); Title = "Navigation Title"; // <---- I want change bar title when I tabbed pageA tab button so title become : "Page A Title" }

many thanks indeed.

regards,


Iconize plugin for Xamarin.Forms - Easily add icon fonts to your projects

How to setup a app with multi currency support?

$
0
0

My application have multi currencies,so how to setup currency on my application.
I have a settings page,when user change country then currency will change automatically?

how to do this in xamarin forms?

How to catch a local notification when the app is in background?

$
0
0

I am using the UNUserNotificationCenter to show some local notifications on iOS. These are scheduled notifications. Here is my high-level requirement:

I am given a Start Date (01-June-2018) and an End Date(28-June-2018) and a time (For ex: 2:00 PM everyday). These local notifications should trigger in between the specified dates only.

Here is my code:

    var content = new UNMutableNotificationContent();
        content.Title = "Title";
        content.Subtitle = "Subtitle";
        content.Body = "Body";
        content.Badge = 1;
        content.CategoryIdentifier = categoryID;
        content.Sound = UNNotificationSound.Default;

        var d = new NSDateComponents {
            Hour = 14
        };
   //Repeat is true, so it will keep triggering when ever the hour reads 14
        var newTrigger = UNCalendarNotificationTrigger.CreateTrigger(d, true);
        var requestID = "notificationRequest";
        var request = UNNotificationRequest.FromIdentifier(requestID, content, newTrigger);

        //Here I set the Delegate to handle the user tapping on notification
        UNUserNotificationCenter.Current.Delegate = new CustomUNUserNotificationCenterDelegate();

        UNUserNotificationCenter.Current.AddNotificationRequest(request, (err) => {
            if (err != null) {
                // Report error
                System.Console.WriteLine("Error: {0}", err);
            } else {
                // Report Success
                System.Console.WriteLine("Notification Scheduled: {0}", request);
            }
        });

And I am checking the condition in WillPresentNotification method:

public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)  {
        DateTime StartDate = new DateTime(2018, 6, 1, 0, 0, 0);
        DateTime EndDate = new DateTime(2018, 6, 28, 0, 0, 0);
        if ((DateTime.Now > StartDate) && (DateTime.Now < EndDate)) {
            UIAlertView alertView = new UIAlertView();
            alertView.Message = "within the date range";
            alertView.AddButton("OK");
            alertView.Show();
            completionHandler(UNNotificationPresentationOptions.Alert | UNNotificationPresentationOptions.Sound | UNNotificationPresentationOptions.Badge);
        } else {
            var requests = new string[] { "notificationRequest" };
            UNUserNotificationCenter.Current.RemovePendingNotificationRequests(requests);
        }
    }

This works fine if the app is in foreground and the notifications automatically cancel off. But if the app is killed then these notifications still keep coming. Is there a way to check when a local notification is fired in the background so that the above logic can be checked?

Also, I am not quite familiar with iOS, does UICalenderNotification trigger have an expiry date?

Am I doing something wrong here or should be thinking of doing it differently?

I was also thinking of using a background fetch and have a piece of code that would check the above logic for the date range.

Any help is appreciated. Thanks!

launch the application when receive the notification without tap in ios

$
0
0

I want to launch the application when receive the FCM notification without tap on notification.I implement it in android end its working fine but we didn't
find any solution for ios using xamarin.forms.

How to use the DepencyService correctly to save files...

$
0
0

Hey everyone!
I'm quite sure that I'm just having a little issue with using the DependencyServicce that drives me nuts... I have read through the documentation on the Mircrosoft Website and Implented a SaveAndLoad feature. Now everytime i call the DependencyService to save a File i get a NullReference Exception. I have read the other posts which were suggesting to register the concrete plattform specific class to the DependencyService, but i did that so i dont know where i went wrong.
Interface in the PCL

 public interface ISaveAndLoad
    {
        void SaveText(string filename, string text);
        string LoadText(string filename);
    }

Concrete implementation in the Android Project

[assembly: Dependency(typeof(Test.Droid.SaveAndLoad))]
namespace Test.Droid
{
    public class SaveAndLoad
    {
        public void SaveText(string filename, string text)
        {
            var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var filePath = Path.Combine(documentsPath, filename);
            File.WriteAllText(filePath, text);
        }
        public string LoadText(string filename)
        {
            var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var filePath = Path.Combine(documentsPath, filename);
            return System.IO.File.ReadAllText(filePath);
        }
    }
}

Call to the DepndencyService in the DAL

DependencyService.Get<ISaveAndLoad>().SaveText("tasks.json", json);
Viewing all 91519 articles
Browse latest View live


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