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

I'd need to implement a calendar. Can anyone send me any guide to do that?

$
0
0

I'm trying to implement a very simple month calendar (with a month view) and I thought to use a simple grid.. I know there are many third part components, but any guide would be very appreciated..


Xaml Compilation - Object reference not set to an instance of an object

$
0
0

When trying to use XAML Compilation i always get this issue when building:

1> Module: TestApp.dll
1> Resource: TestApp.Page1.xaml...
1> Parsing Xaml... done.
1> Replacing Page1.InitializeComponent ()... failed.
1> C:\ProyectosInvestigacion\TestApp\TestApp\TestApp\TestApp.Page1.xaml : error : Object reference not set to an instance of an object.
1> at Xamarin.Forms.Build.Tasks.SetNamescopesAndRegisterNamesVisitor.CreateNamescope()
1> at Xamarin.Forms.Build.Tasks.SetNamescopesAndRegisterNamesVisitor.Visit(RootNode node, INode parentNode)
1> at Xamarin.Forms.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
1> at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()

I've done a simple TestProject in which i added one Xaml page and configured it to compile:

    [XamlCompilation(Xamarin.Forms.Xaml.XamlCompilationOptions.Compile)]
    public partial class Page1 : ContentPage
    {
        public Page1()
        {
            InitializeComponent();

        }
    }

And the Xaml here:

<?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="TestApp.Page1">
  <Label x:Name="lblText" Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

This always throws "Object reference not set to an instance of an object" on the Error List using Visual Studio 2013, Xamarin Forms 2.1.0.6529
I'm attaching the whole solution so anyone can reproduce this error.

Is there a known way to get Xaml Compilation working?

not able to add WCF service reference in xamarin form application in vs 2015.

Implementing Radio button contrl in Xamarin forms

$
0
0

Hi,

We are evaluating Xamarin.Forms with creating sample application.We are not able to find Radio button control in Xamarin.Forms. Kindly anyone show me the direction on how to implement Radio button in Xamarin.Forms Control.Can we port(use) Xamarin radio button control in Xamarin.Forms using Custom renderer or any other options available to utilize the Radio button in Xamarin.Forms.

Kindly suggest me on this with any sample.

Thanks

After enabling MultiDex, Android app crashes after deployment

$
0
0

Our project has expanded to include libraries with a method count >= 64k so we have had to enable MultiDex.
Since enabling it, my app is crashing immediately upon deployment to my android emulator.

I've searched the web and the only solution I have found is to uninstall all of the xamarin.android and mono runtimes on the device, which I have done. This did not solve it.

Note: my project is Xamarin.Forms with a portable project

My device log shows the following output with errors after the app crashes.

this line in particular indicates to me that the MultiDex option caused some issue:

java.lang.RuntimeException: Unable to instantiate application md5ca27074e405277e6c40e6a6588077a84.MainApplication: java.lang.ClassNotFoundException: Didn't find class "md5ca27074e405277e6c40e6a6588077a84.MainApplication" on path: DexPathList[[zip file "/data/app/com.cii.patrollive-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.cii.patrollive-1, /system/lib]]

Full device log output:

01-10 08:38:44.593 5" KitKat (4.4) XXHDPI Phone Error 1966 memtrack Couldn't load memtrack module (No such file or directory)
01-10 08:38:44.593 5" KitKat (4.4) XXHDPI Phone Error 1966 android.os.Debug failed to load memtrack module: -2
01-10 08:38:44.565 5" KitKat (4.4) XXHDPI Phone Error 1966 cutils-trace Error opening trace file: No such file or directory (2)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:5001)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime Caused by: java.lang.ClassNotFoundException: Didn't find class "md5ca27074e405277e6c40e6a6588077a84.MainApplication" on path: DexPathList[[zip file "/data/app/com.cii.patrollive-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.cii.patrollive-1, /system/lib]]
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.os.Looper.loop(Looper.java:136)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime ... 11 more
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.ActivityThread.access$1500(ActivityThread.java:135)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at java.lang.reflect.Method.invoke(Method.java:515)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:102)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.Instrumentation.newApplication(Instrumentation.java:975)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime Process: com.cii.patrollive, PID: 1948
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime java.lang.RuntimeException: Unable to instantiate application md5ca27074e405277e6c40e6a6588077a84.MainApplication: java.lang.ClassNotFoundException: Didn't find class "md5ca27074e405277e6c40e6a6588077a84.MainApplication" on path: DexPathList[[zip file "/data/app/com.cii.patrollive-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.cii.patrollive-1, /system/lib]]
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at java.lang.reflect.Method.invokeNative(Native Method)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime FATAL EXCEPTION: main
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at dalvik.system.NativeStart.main(Native Method)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
01-10 08:38:39.201 5" KitKat (4.4) XXHDPI Phone Error 1948 AndroidRuntime at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
01-10 08:38:38.917 5" KitKat (4.4) XXHDPI Phone Error 1938 memtrack Couldn't load memtrack module (No such file or directory)
01-10 08:38:38.917 5" KitKat (4.4) XXHDPI Phone Error 1938 android.os.Debug failed to load memtrack module: -2
01-10 08:38:38.845 5" KitKat (4.4) XXHDPI Phone Error 1938 cutils-trace Error opening trace file: No such file or directory (2)
01-10 08:38:38.541 5" KitKat (4.4) XXHDPI Phone Error 1926 cutils-trace Error opening trace file: No such file or directory (2)
01-10 08:38:38.469 5" KitKat (4.4) XXHDPI Phone Error 1926 memtrack Couldn't load memtrack module (No such file or directory)
01-10 08:38:38.469 5" KitKat (4.4) XXHDPI Phone Error 1926 android.os.Debug failed to load memtrack module: -2
01-10 08:38:34.757 5" KitKat (4.4) XXHDPI Phone Error 1896 android.os.Debug failed to load memtrack module: -2
01-10 08:38:34.757 5" KitKat (4.4) XXHDPI Phone Error 1896 memtrack Couldn't load memtrack module (No such file or directory)
01-10 08:38:34.729 5" KitKat (4.4) XXHDPI Phone Error 1896 cutils-trace Error opening trace file: No such file or directory (2)
01-10 08:38:34.445 5" KitKat (4.4) XXHDPI Phone Error 1880 android.os.Debug failed to load memtrack module: -2
01-10 08:38:34.445 5" KitKat (4.4) XXHDPI Phone Error 1880 memtrack Couldn't load memtrack module (No such file or directory)
01-10 08:38:34.421 5" KitKat (4.4) XXHDPI Phone Error 1880 cutils-trace Error opening trace file: No such file or directory (2)
01-10 08:38:34.145 5" KitKat (4.4) XXHDPI Phone Error 1866 android.os.Debug failed to load memtrack module: -2
01-10 08:38:34.145 5" KitKat (4.4) XXHDPI Phone Error 1866 memtrack Couldn't load memtrack module (No such file or directory)
01-10 08:38:34.113 5" KitKat (4.4) XXHDPI Phone Error 1866 cutils-trace Error opening trace file: No such file or directory (2)

SQLite.net NullReferenceException whilst following provided Xamarin example(s)

$
0
0

Hey guys,

Me again, with a different question about a different subject; SQLite.

I've got quite good skills in scripting SQL queries, but I'm struggling to connect my XamarinForms (Portable) solution to a local database.

I've followed the guide provided by Xamarin and their example on Github.

However, as mentioned I'm having some issues with connecting my already created solution with the database. Debugging my solution gives me nothing except an error message:

System.NullReferenceException: Object reference not set to an instance of an object.

in my for loop (looping through every object in a list of objects ):

foreach (Foundation found in result)
                {
                    await App.Database.SaveItemAsync(found);
                    count++;
                    Debug.WriteLine(count.ToString());
                }

result is the resulting set (List) from a call to a RESTful Api that most assuredly is NOT null, and is invoked after the result has been assigned to.

The reference to App.Dabatase.SaveItemAsync() is linked similar to the provided github example mentioned above.

Here is a linkto my project on Github. For the full source code, please see the referred Github link provided in previous sentence as it would be too much to write it all here.

The relevant files are App.cs, Data -> FoundationsDatabase.cs and GetFoundationsPage.cs

getting a constructor to wait for a method to finish run before proceeding

$
0
0

I have a method that connects to a database
public EventsList() {
var response =AmazonUtils.DynamoDBClient.ScanAsync("Event", attributesToGet, new System.Threading.CancellationToken()).ContinueWith((Task<Amazon.DynamoDBv2.Model.ScanResponse> arg) =>
{

          var results =  arg.Result;

          foreach (Dictionary<string, AttributeValue> item in results.Items)
          {
           //the processitem method takes the attributename and value and just adds a new item to the array of items

           ProcessItem(item);

          }


         });

// events is an array of items which is global

this.Items = events

}

but the the issue is the constructor wont wait for the results
and items will be null for that page

since i cant have an async constructor im lost to what should i do. all the other examples show only to load one item which is not what i need
i need to load 4 - 6 items
but i cant do that cause the constructor will finish and the items wont load into my page cause of it
i am getting data cause the processitem spits the data out to the console but it loads after the page loads

im trying every thing and still coming up short i had it working before with a listview.itemsource property but i cant change the orientation cause my ui needs to go horizontal
i thought writing a custom render would allow me to change the orientation but that didnt work

Make my app "shareable"

$
0
0

Hi there !!

I'm developing an app on Xamarin Forms (Android/iOS). My app needs to be shareable for some types of file (as documents and images). I mean that from File Manager I can select a file and then press the share button and select my app to "share" the file. How can I do that ? I was looking at Share Plugin but I'm not sure that it is what I'm looking for.

Thanks !


How to bind a database item to a list

$
0
0

Hi all, im trying to make a list with a grid in that holds the items in my database so far i have this but i an stuck because i dont know where to bind the items to or if im even doing it right.

`var listView = new ListView
{

            ItemsSource = _sqLiteConnection.Table<TodoItem>().Where(t => t.Event == "50m Freestyle"),
            ItemTemplate = personDataTemplate



        };`

var personDataTemplate = new DataTemplate(() =>
            {
                var grid = new Grid();
                grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
                grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
                var Left = new Label { Text = "" +   };
                var Right = new Label { Text = "Right" };
                grid.Children.Add(Left, 0, 0);
                grid.Children.Add(Right, 0, 1);

Database :

`public class TodoItem
{

    [PrimaryKey, AutoIncrement]
    public int ID { get; set; }

    public string Time { get; set; }

    public string Event { get; set; }

    public decimal ActTime { get; set; }

    public DateTime Swam { get; set; }


}`

Thanks for the help :)

Visual Studio Erro

$
0
0

Severity Code Description Project File Line Suppression State
Warning 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. AluraAPP.iOS.

I using Xamarin.form

I already reinstalled the visual studio and xamarin vs, but this error to be continued.

someone has gone through this error ??

i need help.

Insert ItemsSource directly into XAML

$
0
0

Hi,

I want to build a ListView of Buttons (to make a menu).
It does not make sense to me to bind the "ItemsSource" of the ListView to something defined in C# code, because it is not part of the data model.

Can I somehow define the ItemsSource in Xaml?

Thanks!

Error: cannot convert binding to (anything)

$
0
0

I'm trying to bind a item class object to my view model from a page in xamarin forms. But at runtime, when the Item is getting bound to custom control it throws an error saying I cannot convert binding to type 'MenuItem' with no stack trace. Am I binding correctly? Am I allowed to do this? Please help! What are some alternatives around this?

XAML:

<local:MenuItemControl x:Name="scanMenuItem"  Item="{Binding Item}"></local:MenuItemControl>

Code Behind:

    public Home()
            {
                InitializeComponent();

                scanMenuItem.BindingContext = new MenuItemModelView(new MenuItem("Scan", "", new Scan()));

                NavigationPage.SetHasNavigationBar(this, true);

                Title = "Home";
            }

MenuItemModelView:

public class MenuItemModelView : ViewModel
    {
        public MenuItem item { get; set; }
        public Command MenuItemSelectedCommand { get;}

        public MenuItemModelView(MenuItem item)
        {
            this.item = item;
            MenuItemSelectedCommand = new Command(async() => await OnMenuItemSelectedCommand());
        }

        public MenuItem Item
        {
            get
            {
                return item;
            }
            set
            {
                if (value != item)
                {
                    item = value;
                    OnPropertyChanged();
                }
            }
        }

        public async Task<bool> OnMenuItemSelectedCommand()
        {
            if (item.pageTo != null)
            {
                await CurrentPage.Navigation.PushAsync(item.pageTo);
                return true;
            }
            return false;
        }
    }

MenuItemControl:

    public class MenuItemControl : ContentView
    {
        public MenuItem Item { get; set; }
        public MenuItemControl()
        {
            if (Item == null){
                Item = new MenuItem("", "", null);
            }

            BoxView line = new BoxView
            {
                HeightRequest = 1,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#f1f1f1")
            };

            Label title = new Label
            {
                Text = Item.title,
                Margin = new Thickness(10, 2, 0, 0),
                HorizontalOptions = LayoutOptions.StartAndExpand,
            };

            Label subTitle = new Label
            {
                Text = Item.subtitle,
                Margin = new Thickness(10, 2, 10, 0),
                FontSize = 14,
                TextColor = Color.FromHex("#c1c1c1"),
                HorizontalOptions = LayoutOptions.End,
            };

            Image image = new Image
            {
                HorizontalOptions = LayoutOptions.End,
                Source = "icons/blue/next",
                WidthRequest = 20
            };

            Content = new StackLayout
            {
                Children = {

                    line,
                    new StackLayout{
                        Orientation = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Fill,
                        Padding = new Thickness(10),
                        Children ={

                            title,
                            subTitle,
                            image
                        }
                    }
                }
            };
        }
    }

MenuItem:

public class MenuItem
    {
        public Page pageTo { get; set; }
        public string title { get; set; }
        public string subtitle { get; set; }
        public string iconPath { get; set; }

        public MenuItem(string title, string subtitle, Page pageto)
        {
            this.title = title;
            this.subtitle = subtitle;
            this.pageTo = pageto;
        }
    }

How to communicate bluetooth paired devices in Xamarin

$
0
0

Hi Any One please let me know process or sample code for getting Bluetooth paired devices in Xamarin.forms or if it will not support from PCL please suggest for from Native level i.,e separate Android(.Droid) and iOS(.iOS).

React Native

$
0
0

is it possible to use Facebook react native with Xamarin forms?

Packages Folder missing in Solution outline

$
0
0

The Packages folder is missing from the Solution outline in my Shared project. Therefore, I can't add any packages or update any packages in my Shared project.


Custom Grid Not Normal work

$
0
0

I have a custom grid named EasyTabView.
use xaml:

<local:EasyTabView>
        <local:EasyTabView.TabHeaders>
            <Label Margin="8" Text="Header1" VerticalOptions="Center" HorizontalOptions="Center">
            </Label>
            <Label Text="Header2" VerticalOptions="Center" HorizontalOptions="Center">
            </Label>
        </local:EasyTabView.TabHeaders>
        <local:EasyTabView.TabContents>
            <ContentView>
                <Label Margin="8" Text="Content1" VerticalOptions="Center" HorizontalOptions="Center">
            </Label>
            </ContentView>
            <ContentView>
            <Label Text="Content2" VerticalOptions="Center" HorizontalOptions="Center">
            </Label>
            </ContentView>

        </local:EasyTabView.TabContents>
    </local:EasyTabView>

grid define code:
```C#
foreach (var tabHeader in TabHeaders)
{
ColumnDefinitions.Add(new ColumnDefinition()
{
Width = GridLength.Star
});
}

        RowDefinitions = new RowDefinitionCollection() {
            //头
            new RowDefinition()
            {
                Height = GridLength.Auto
            },
            //指示标示
            new RowDefinition()
            {
                Height = IndicatorHeight
            },
            //内容
            new RowDefinition()
            {
                Height = GridLength.Star
            }

        };

        this.BatchBegin();
        // 设置TabHeaders 显示
        for (int i = 0; i < TabHeaders.Count; i++)
        {
            //SetRow(TabHeaders[i], 0);
            //SetColumn(TabHeaders[i], i);
            Children.Add(TabHeaders[i], i, 0);
        }
        //设置指示器
        var indicatorView = new BoxView();
        indicatorView.Color = SelectedColor;
        Children.Add(indicatorView, SelectedIndex, 1);
        //设置TabContents 显示
        for (int i = 0; i < TabContents.Count; i++)
        {
            TabContents[i].IsVisible = SelectedIndex == i;
            Children.Add(TabContents[i], 0, TabContents.Count, 2, 3);
        }
        this.BatchCommit();

```

But there's a problem right now,the Grid not display the child first.When the second show,the child just show and Multiple the child while repeat add.i try call the InvalidateLayout() method No effect。who can help me。

Estimote SDK for Android , does it work for you ?

$
0
0

Hello guys, i wonder if any of you have managed to make an estimote app that can detect beacons on android/ forms . I have tried using the Xamarin Estimote SDK for android, but never managed to go beyond the ready state for the manager. Did anyone succeed to get some results ?

Is it possible to write a custom renderer to change the orientation of a listview

$
0
0

plainly speaking can i get it to go horizontal instead of vertical if i write a custom renderer.

if yes what method or element must i use or change

cause my UI needs to go horizontal and be able to bind via itemsource

Project bundle identifier XXX does not match specified provisioning profile

Problem LinkAssemblies

$
0
0

Hi all,

I have a problem when i try to compile release version of my android project . My error is that

Gravité    Code    Description Projet  Fichier Ligne   État de la suppression
Erreur      Échec inattendu de la tâche "LinkAssemblies".
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Mono.Security.Interface.MonoTlsProviderFactoryDelegate' (defined in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') from 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Mono.Security.Interface.MonoTlsProviderFactoryDelegate
   à Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   à MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   à Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
   à Mono.Linker.Steps.MarkStep.InitializeFields(TypeDefinition type)
   à Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
   à Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   à Mono.Linker.Steps.MarkStep.Initialize()
   à Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   à Mono.Linker.Pipeline.Process(LinkContext context)
   à MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   à Xamarin.Android.Tasks.LinkAssemblies.Execute()
   --- Fin de la trace de la pile d'exception interne ---
   à Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   à Xamarin.Android.Tasks.LinkAssemblies.Execute()
   à Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   à Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()  CTBand.Droid

I have try to change my "target android version" and my "minimum android to target" but without succes.

When i compile on Debug, it's works fine.

So how can i repair this bug?

Thanks in advance.

Viewing all 91519 articles
Browse latest View live


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