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

Create a Xamarin library which can be consume by native iOS, Android applications

$
0
0

Hello!

Actually, i want to reuse my Xamarin shared code into different native apps.
For this,i require to create a Xamarin lib which can be consume by native iOS & Android applications.but, i don't know how to create such library using Xamarin. if anyone can have solution please do share here.

Or else
if any other way to reuse Xamarin shared code into native apps then please suggest.

Best Regards,
Rahul Bhamare.


Developer needed to finalise on-going project

Xamarin Forms UWP - Display PDF

$
0
0

Hi everyone. Please, help me and tell me what am I missing.

My goal is to show simple PDF file in the WebView control. Can I bind path of the file to the Source property of the WebView? Or what is the correct way to show PDF in UWP?

P.S. and if the only option is to do like here (Display a Local PDF File in a WebView) - how must I add pdf.js to my project??

Project is not compatible with target of PCL, IDE0006, mscorlib conflict

$
0
0

The app has no build errors, (a few warnings) but fails when deployed on debug or release. The messages when things start to go sideways is: (slightly condensed)

Unable to add a reference to project 'Water'. The Current project's target is not one of or compatible with the targets of Portable Library project 'Water'

IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. Water.Android

The App is a Xamarin.forms PCL project and an droid project. This will be a data app with SQLite for data access. Currently there is just bare-bones data access with two content pages, each with one label each.

When I attempt to deploy the app on a physical phone, I get in the output:

"No way to resolve conflict between "mscorlib=4.0.0.0" and "mscorlib, Version = 2.0.5.0"

Build is said to succeed, pulls up a white screen, no label, but crashes immediately, before reaching breakpoint set on app() constructor

Things I have tried:

moving project from %\documents\Visual Studio 2017\projects to C:\repos
Clean both projects, remove all bin/obj folders, NugetConsole->Update-Package -Reinstall, rebuild, run on device (as both debug and release)
Ensure that droid project is compiling with same sdk as the target
Looking at configurations of all solutions/projects(This seems like a perfect place, but I nothing seems relevant in the PCL. Currently am try to target android ONLY, and the PCL properties->Library has nothing to do with Android)

What can I do to fix the mscorlib conflict and fix the conditions that cause the warnings?

Entry.Focus() Not Working For Android

$
0
0

Hello,

Currently, I am using this setup to set focus to an Entry:

protected override void OnAppearing()
{
    base.OnAppearing();

    Entry emailEntry = this.FindByName<Entry>("emailEntry");
    emailEntry.Focus();
}

The Entry is part of a StackLayout. So on the iOS emulator it focuses on the entry and brings up a keyboard. On the Android emulator, however, it just sets focus to the entry, but does not bring up the keyboard. I've noticed other people having the same issues in the forums, but couldn't find an answer or workaround. Are there currently any plans to fix this, and what is a workaround I can use?

Thanks

Check if file exists from a .NetStandard project ?

$
0
0

How can be checked from .NetStandard code if a file exists on device ?

Entry Next/Finished Buttons - Android

$
0
0

When placing multiple Entry controls on a page in Xamarin forms, there appears to be no (obvious) way to enable the Next/Finished buttons that appear on the device keyboard. The buttons appear, but clicking them does nothing.

You can replicate this in the 'FormsSample' app on the 'Entry (single line)' page. The next button appears on the email and password fields, and the finished button on the phone number field, but none of the do anything.

Am I missing something obvious or is this a bug/feature omission?

Thanks

Picker not showing value

$
0
0

I need to set a value to picker but it seems to not work in two way:

<Picker ItemsSource="{Binding myModelList}"
        SelectedItem="{Binding myModel, Mode=TwoWay}" />

ViewModel:

public class TestViewModel : ObservableProperty
{
    public List<MyModel> myModelList { get; set; }
    private List<MyModel> _myModel;
    public List<MyModel> myModel;
    {
        get
        {
            return _myModel;
        }
        set
        {
            _myModel = value;
            OnPropertyChanged("myModel");
        }
    }

    async public Task prepareModels()
    {
        myModelList = await DB.query<MyModel>("SELECT * FROM MyModel;");
    }

    async public Task loadModel(int modelId)
    {
        myModel= await DB.getById<MyModel>(modelId);
    }

}

After call load model not is showing in picker. I created a button to show the selectedItem and its have an item selected, but got nothing in UI.
Any help?


NotImplementedException for Xamarin.Settings.Plugin

$
0
0

So I'm trying to setup the Settings Plugin by @JamesMontemagno (https://www.nuget.org/packages/Xam.Plugins.Settings/) to work with my PLC. I've set it up as explained in the README and on Git however I'm getting a NotImplementedException? I've tried Cleaning and Rebuilding the project and the entire solution and using it on different devices with no luck.

This is the Settings file: http://pastebin.com/FcJMLFcs
This is the code that uses it: http://pastebin.com/f7cnGgwW

All of the code for the Settings.Plugin is used in the PLC project, the solution is ran on an android device and this is the error that I am getting:

System.NotImplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

Not really sure what to do, I've surfed the web looking awnsers but no-one else seems to be getting this? Any help would be great!

JSON Startup Performance on Android

$
0
0

What libraries are people using on Android for JSON? I've noticed a very heavy performance hit using Newtonsoft on Android (my guess is reflection). Anyone else see this?

base.GetCellCore() Exception

$
0
0

I have a Forms app and I am trying to add a custom renderer for the listview viewcell. For Android I am overriding the GetCellCore() routine and in here making a call to "var cell = base.GetCellCore(item, convertView, parent, context) as ViewGroup; ".
This call fails with an invalid cast exception, but no details on what is causing it. I'm using VS 2017, Xamarin.Forms(2.3.5.256-pre6). It does work in another older sample app on VS 2015 and Xamarin.Forms(2.3.3.175). Any thoughts on what is causing this?

Xamarin Form MVVM - Bindable Map.

$
0
0

Hi,

I'm trying to use a bindable map control (e: TK.CustomMap) on my Xamarin.Forms Prism MVVM project.

I find out that the Xamarin.Forms.Maps official package do not use MVVM pattern and it's not bindable.

I need your help! I can't make TK.CustomMap works with Prism and I don't find any other sample that work with it.

Thanks!

Let's talk performance

$
0
0

As we continue to release performance focused features and fixes, and build processes around performance, I want to have a thread dedicated to those items.

Our public roadmap itemizes the feature work we are doing and planning to do, and items related to performance are tagged. In addition to that, we are building into our CI processes ways to measure and compare performance metrics. The goal is that with specific commits and builds we can get visibility to any impact on speed and memory usage.

One of the initiatives I'm spearheading is to populate a solution with UIs that are representative of your applications. To that end, I'm asking you to consider sharing those layouts with us. Perhaps the best way to gather them would be to open a repository and have you submit pull requests. I'll get working on that next and post details here.

Fast Renderers for Android are now merged and in nightly and will be our next pre-release. I hope some of you will take some time to test them out and report back here with your findings.

Center view with proportional width only

$
0
0

Hi,
I am making a login page. There is a small view (frame) in the middle that fills 50% of the width, and the height just takes whatever it needs. Is this possible?
In all the ways I know, you either have to set both height and width to a proportional value, and then you can center (using LayoutBounds and LayoutFlags), but I dont want the height to be proportional. I think maybe I could center the frame in a stackview, but I guess then I wont have the proportional width.
I can also use math in code to just move the window, but I preffer keeping it in XAML; there must be a simple way to fix such an easy thing, right?

This is my current code. It is not working properly, because the anchor point of the frame is at 0,0, and not in the middle, so its filling up 50%-100% of the width instead of 25%-75%:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MariusVipApp.Login">
    <RelativeLayout HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"
                BackgroundColor="#008aff">

    <Frame CornerRadius="15"
           OutlineColor="DarkGray"
           BackgroundColor="White"
           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5}"
           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.5}"
           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5}">
        <StackLayout Orientation="Vertical">
            <Label x:Name="labelUsername"
                   FontAttributes="Bold">

            </Label>
            <Entry x:Name="entryUsername"
                   FontAttributes="Bold"
                   HorizontalTextAlignment="Start">

            </Entry>
            <Label x:Name="labelPassword"
                   FontAttributes="Bold">

            </Label>
            <Entry x:Name="entryPassword"
                   HorizontalTextAlignment="Start"
                   FontAttributes="Bold"
                   IsPassword="True">

            </Entry>
        </StackLayout>
    </Frame>
    </RelativeLayout>
</ContentPage>

Pdf Viewer control ?

$
0
0

Can somebody recommend a (free) PdfViewer control ?


SIGABRT while debugging async methods

$
0
0

These methods used to work fine, but iOS rejected our latest App version because an unspecified error.

While debugging, they work fine, unless you go step by step after a breakpoint. After said methods finish, we get this exception:

´=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================´

We cannot progress and send the app to the store unless this gets corrected.

A brief example of one of our async methods:

async Task chargeLists () {
//Hide main screen
scroll.IsVisible = false;
//Show hidden screen with an ActivityIndicator and a "Loading" text
overlay.IsVisible = true;
await Task.Run (() => {
//Do something while thinking
});
//Hide creen with an ActivityIndicator
overlay.IsVisible = false;
//Show main screen
scroll.IsVisible = true;
}

This method is used in the first screen and is called by:

protected override async void OnAppearing () {
try {
await chargeLists ();
base.OnAppearing ();
} catch (Exception ex) {
Debug.WriteLine (string.Format ("Error: {0}", ex.Message));
}
}

protected override async void OnDisappearing () {
try {
await chargeLists ();
base.OnDisappearing ();
} catch (Exception ex) {
Debug.WriteLine (string.Format ("Error: {0}", ex.Message));
}
}

Please and thank you for your help.

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.

Best Practice on Application Settings using Xamarin.Forms

$
0
0

Hello!

I would like to ask the community for some advice regarding the creation of a “Settings” view. The goal is to provide options to a user and store them as application settings. I’m using Xamarin Forms and was hoping for a “generic” solution, using as much shared code as possible. I’m targeting Android and WinPhone primarily.

I studied these examples: the “Step Counter” application (https://xamarin.com/prebuilt/step-counter) and http://www.qualtechsoftware.com/qualtechsoftware/2014/01/menus-menus-menus-android-with-xamarin/. I understand the technique they applied, but there not using Xamarin Forms.

My question: what is to be considered best practice for managing application settings when using Xamarin Forms (hence, trying to be as “generic” as possible)? Maybe a small app demonstrating this, or a link to a relevant article?

Thank you all for your time!

How to find unbounded or unpaired Bluetooth device Xamarin forms ?

$
0
0

I have found bounded device but need scan unbounded or unpaired Bluetooth device Xamarin forms.

for Custom loader

$
0
0

can we create custom loader for activity indicator in Xamarin forms!

Viewing all 89864 articles
Browse latest View live


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