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

Is it possible to create Left Menu bar without using master detail Page in xamarin forms

$
0
0

I'm new to xamarin, Can anyone help me to implement the left navigation bar


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.

Behaviors in ControlTemplates

$
0
0

I have a ControlTemplate defined in App.xaml for pages with ListViews like so:

<ControlTemplate x:Key="BaseModelListPageTemplate">
    <StackLayout>
        <Label
        Text="{TemplateBinding BindingContext.Category}"
        BackgroundColor="Green"
        TextColor="White"
        FontSize="24"
        FontAttributes="Bold"/>
        <ListView
            x:Name="ItemListView"
            HasUnevenRows="true"
            ItemsSource="{TemplateBinding BindingContext.ItemsList}"
            IsPullToRefreshEnabled="true"
            IsRefreshing="{TemplateBinding BindingContext.IsBusy, Mode=OneWay}"
            RefreshCommand="{TemplateBinding BindingContext.ReloadCommand}"
            ItemTemplate="{StaticResource BaseModelDataTemplateSelector}">
            <ListView.Behaviors>
                <Behaviors:ListViewScrollBehavior Command="{TemplateBinding BindingContext.LoadMoreCommand}"/>
            </ListView.Behaviors>
        </ListView>
    </StackLayout>
</ControlTemplate>

All bindings compile with no errors. The trouble is that an InvalidOperationException gets thrown: Operation is not valid due to the current state of the object. It worked fine when it was directly in a page and not in a ControlTemplate.

StackTrace is of little help:

at Xamarin.Forms.TemplateBinding+<Apply>d__17.MoveNext () [0x00018] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\TemplateBinding.cs:82
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
  at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSAction.cs:163
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
  at EZDelivery.iOS.Application.Main (System.String[] args) [0x00008] in /Users/taylorartunian/Projects/EZDelivery/iOS/Main.cs:17

Memory Leak issue occurs when trying to create a control using the UITextField as base class

$
0
0

I have created a custom control inheriting the UITextField as base class. When checking the memory leak issue, the memory leak issue occurs in the UITextField itself. We have disposed all the objects. But still UITextField alone remains in memory. We have tried changing UITextField with UIlabel and UILabel gets disposed correctly.
Could anyone have solution for this issue?

Issue with creating libMTSCRA.a file for Magtek

$
0
0

Hi All,
Actually, i have the sdk for Magtek Device and i want to generate the DLL of it. So, when i run the makefile in terminal window i get an error for reading this libMTSCRA.a file and DLL not create. the error is: error CS1566: Error reading resource file `libMTSCRA.a' and i get this error after executing below line.:
/Developer/MonoTouch/usr/bin/btouch -out:MagTek.iDynamo.dll MagTek.iDynamo.cs -s:enums.cs -x:AssemblyInfo.cs --link-with=libMTSCRA.a,libMTSCRA.a

So, Please if anyone have any idea about this issue help me, i have waste my lot of time on this. but i could not find any result.

Xamarin ios : Getting System.ArgumentNullException in AppDelegate.cs class

$
0
0

In my xamarin forms project I run my xamarin ios part for the first time, but getting System.ArgumentNullException in AppDelegate.cs class. Following is the screenshot of exception:

I added all the icons in the resource folder but still getting the same exception, anybody please suggest a solution.

Thanks in advance

New Xamarin form project have packages conflicting and cant compile. How can I fix it?

$
0
0

Each time I try to create a new xamarin forms project, errors like this appears.

Error NU1202 El paquete Xamarin.Android.Support.v7.CardView 25.4.0.2 no es compatible con monoandroid60 (MonoAndroid,Version=v6.0). El paquete Xamarin.Android.Support.v7.CardView 25.4.0.2 admite: monoandroid70 (MonoAndroid,Version=v7.0)

I have googled a lot and I have no idea of how to fix it, I havent done anything, this just doesnt allow me to compile the project.
So, what am I supposed to do?

Visual studio 2017 is updated to the latest version btw.

Problems after update xamarin forms on vs2017

$
0
0

I recently update my xamarin forms, and when i create the project, i dont know why the target framwork go to 2.0 as you see in the picture error 1
and when i try to import from nugget a bild like BCL throw the error that you see on the image error2

as you could see on the image show1 you could see that i have all the framwork versions installed


ZXing barcode reader

$
0
0

I am having some issues with ZXing tool with Xamarin.Forms and on the IOS (ipad) platform. When I hold the IPad in the landscape position everything works find with scanning a barcode. When I hold the Ipad in the portrait (vertical) position and try to scan a barcode it doesn't work. It won't read the barcode until I rotate the barcode to a verticle (top/bottom) position. This seems to work fine on an Android no matter how I hold my phone. Just wondering if there is something I am missing?

Essentially my current code is as follows:

var scanPage = new ZXingScannerPage ();
// Navigate to our scanner page
await Navigation.PushAsync (scanPage);

scanPage.OnScanResult += (result) =>
{
    // Stop scanning
    scanPage.IsScanning = false;

    // Pop the page and show the result
    Device.BeginInvokeOnMainThread (async () =>
    {
        await Navigation.PopAsync ();
        await DisplayAlert("Scanned Barcode", result.Text, "OK");
    });
};

There is a similar issues posted below but with no solution:
https://stackoverflow.com/questions/44017593/barcode-scanner-does-not-work-in-portrait-mode-xamarin-form

ZXing.Net.Mobile = 2.2.9
ZXing.Net.Mobile.Forms = 2.2.9
Xamarin.Forms = 2.3.4.231

System.Exception: Cannot destroy MyApp.Views.MyNavigationPage when resetting navigation stack

$
0
0

Using Prism 7.0, I'm trying to navigate from ContentPage to a MasterDetailPage. I want to delete the current ContentPage from the navigation stack and go to the MasterDetailPage (Like a login function) like this:

_navigationService.NavigateAsync("../MyMasterDetailPage/MyNavigationPage/ViewB");

This works succesfully. Now, I want to make a logout function that goes back to first page with this:

_navigationService.NavigateAsync("../../../MyNavigationPage/ViewA");

This gives the following error:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

But I'm quite sure there are three elements in this list, MyMasterDetailPage, MyNavigationPage and ViewB. So I tried to use an absolute URI, like this:

_navigationService.NavigateAsync("myapp:///MyNavigationPage/ViewA");

Which results in the error message:

System.Exception: Cannot destroy MyApp.Views.MyNavigationPage

What happens under water when calling an absolute URI in Prism 7.0 to create this error? And is only ViewB counted as an entry and that's why I cannot navigate three steps back?

How to access the Method which is inside an Android Service from the Xamarin.Forms in PCL project

$
0
0

How to access the Method which is inside an Android Service from the Xamarin.Forms in PCL project

Scenario:
I have a custom made service running in android
I need to pass values to the method from the PCL project on a specific condition

@AdamP any guess on this problem?

Long Label within a Frame, Frame BackgroundColor doesn't work when Label is long.

$
0
0

Testing device is Android 5.0.2

This is a weird one.

Does Frame has a maximum size limit? When reach certain size, background color is not working anymore?

I need a large label with hundreds lines, so has to customize one LongLabel.

Then label need to be inside a Frame to create this rounded corner and padding around font effect.

However, Frame's BackgroundColor can't be bound or set directly when there are hundreds of lines in my LongLabel.

Frame's BackgroundColor can only be bound or set directly with fewer lines in my LongLabel.

Anyone experience this? How to fix or work around?

Thanks

system.nullreferenceexception in base.FinishedLaunching (app, options);

$
0
0

Hello, in some moment my application wont longer run on simulator.
I get system.nullreferenceexception in my FinishedLaunching method when call return base.FinishedLaunching (app, options);

stack trace:
at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_IntPtr (intptr,intptr,intptr)
at UIKit.UIWindow.set_RootViewController (UIKit.UIViewController value) [0x00010] in /Users/builder/data/lanes/2689/962a0506/source/maccore/src/build/ios/native/UIKit/UIWindow.g.cs:330
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x00035] in :0
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.SetMainPage () [0x00000] in :0
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00028] in :0
at XXX.UI.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00076] in /Users/admin/Desktop/TTI_IOS_DROID_WIN10/iOS/AppDelegate.cs:72
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2689/962a0506/source/maccore/src/UIKit/UIApplication.cs:77
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/2689/962a0506/source/maccore/src/UIKit/UIApplication.cs:61
at XXX.UI.iOS.Application.Main (System.String[] args) [0x00013] in /Users/admin/Desktop/XXX/iOS/Main.cs:20

Application runs fine on real device. Tried to run it on another MacOsX no luck.
Tried to reinstall Xamarin.Studio, Xcode no luck.

Load a image to save the path to later reload image

$
0
0

Hello.

I'm trying too achieve a functionality that the user select a image using a process like this:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/photo-picker/

I changed that to return the Uri instead of the stream. Then I save the Uri in a Database like a string. More later I try to reload the image:

   Android.Net.Uri uri = Android.Net.Uri.Parse(Path);
   Stream stream = activity.OpenUri(uri);

OpenUri it's defined in the MainActivity like:

    public Stream OpenUri(Android.Net.Uri uri)
    {
        return ContentResolver.OpenInputStream(uri);
    }

Because I need a class that inherits": global::Xamarin.Forms.Platform.Android.FormsApplicationActivity" or OpenInputStream doesn't work. But even do is not working.
I think I'm doing a mess. So I ask. Is there a better way to make the user pick an image or file save its path to later reload and reload it?

Thank you.

Icon in the navigation bar in the TabbedPage

$
0
0

See below my App running

below is the Login Page code

public  void Login_Clicked(object sender, EventArgs e)
        {
            LoginService svc = new LoginService();
            LoginRS res = svc.Login(txtUsuario.Text, txtSenha.Text);
            if (res != null && res.Success  )
            {
                App.LooggedUser = res;

                Application.Current.MainPage = new MasterDetailPage
                {
                    Master = new Master(),
                    Detail = new TabbedPage
                    {
                        Children =
                        {
                            new NavigationPage(new Indicadores()){ Title = "Indicadores"},
                            new NavigationPage(new PaineisPage()){ Title = "Painéis"}
                        }
                    }
                };
.....
}

below is my App.xaml.cs

public static bool IsUserLoggedIn { get; set; }
public static string LastPassword { get; set; }
public static LoginRS LooggedUser { get; set; }
public NavigationPage NavigationPage { get; private set; }
public static NavigationPage NavPage { get; set; }

        public static MasterDetailPage MasterDetail { get; set; }
        public async static Task NavigateAsynNavigateMasterDetail(Page page)
        {
            App.MasterDetail.IsPresented = false;
            await App.MasterDetail.Master.Navigation.PushAsync(page);
        }

        public App()
        {
            InitializeComponent();

            if (!IsUserLoggedIn)
            {
                NavPage = new NavigationPage(new LoginPage());
                MainPage = NavPage;
            }
            else
            {
                NavPage = new NavigationPage(new MainPage());
                MainPage = NavPage;
            }
        }

below is my Indicadores constructor page

InitializeComponent();
NavigationPage.SetHasNavigationBar(this, true);
NavigationPage.SetTitleIcon(this, "estapar.png");

I did various attempts trying to put an image in the bar but not get. I thought that navigation bar belong to Detail page, but i'm not getting to do. I tried in the Master, MainPage and nothing. It seems easy but doesn't work. I have no resource, no longer. How can i put an image in the bar next to menu icon? When i thought that solve all my issues appears more.


Cropping images to square in forms

$
0
0

I'm trying to get a user to select/take a picture and then getting a crop view up. I have managed to do this using this library: https://github.com/XAM-Consulting/Xam.Plugins.ImageCropper

But I want to force the image to be a square, not any aspect ratio the user pleases. Is there anyone who knows how to do this?

Is there any other library/plugin that I can use for this?

Adding Windows 8.1 project to Xamarin.Forms App VS2017

$
0
0

It seems like a lot of the documentation I read on this had become out of date.
developer.xamarin.com/guides/xamarin-forms/platform-features/windows/

I created a xamarin forms app for UWP and Android and upon discovering that UWP does not support Windows 8.1 I need to add a Windows 8.1 project to the application. Trying to follow the directions in the below link I am not presented with the necessary options.
developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/tablet/

Some other forums posts allude that this is no longer supported in Visual Studio 2017 which is what I used to create the project.

What are my options?
Can I download VS2015 and open the same project and then follow the instructions for adding a Windows 8.1 app? Or will I not be able to open the project in VS2015?

I am hoping for a minimal effort path to getting this application working on a windows 8.1 tablet.

Any help would be greatly appreciated!

Thanks!

DocumentDB and iOS - loading assembly error

$
0
0

I am using Visual Studio 15.5.2 on Windows and I've connected a MacBook (Xamarin Agent). The connection is fine but my project isn't working.

Error while loading assemblies: /Users/{MacBookName}/Library/Caches/Xamarin/mtbs/builds/{AppName.iOS}/83382c875246032198df400d2ec7399b/bin/iPhoneSimulator/Debug/DocumentDB.Spatial.Sql.dll

Any suggestions?

Xamarin.Forms.2.3.4.247 update : project won't build

$
0
0

Hi,

I just updated Xamarin.Forms to version 2.3.4.247 as well as a couple of other packages, and I get this error, completely new for me:

...\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets(68,4): error MSB4064: The "DebugType" parameter is not supported by the "XamlCTask" task. Verify the parameter exists on the task, and it is a settable public instance property.
...\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets(62,3): error MSB4063: The "XamlCTask" task could not be initialized with its input parameters.

Any idea of possible cause of this error?

The project was initially working with Xamarin.Forms 2.3.1.114, it is a PCL project, not using XMAL.

Thank you.

Could not load file or assembly SQLite-net, Version=1.4.118.0, Culture=neutral, PublicKeyToken=null

$
0
0

Original subject

In SQLLite-net-pcl 1.4.118 I have this error on UWP:

Could not load file or assembly 'SQLite-net, Version=1.4.118.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference.

So, I have downgrade sqlite version to 1.3.3 : stack

But same error:

{System.IO.FileLoadException: Could not load file or assembly 'SQLite-net, Version=1.4.118.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'SQLite-net, Version=1.4.118.0, Culture=neutral, PublicKeyToken=null'
   at GestionnaireCopropriete.Database.GCDatabase..ctor(String dbPath)
   at GestionnaireCopropriete.App.get_Database()
   at GestionnaireCopropriete.SettingsPage..ctor()}

I have clean. Closed and reopen. Delete /obj /bin... I don't understand why this problem is again her.

Viewing all 89864 articles
Browse latest View live