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

Xamarin Form:Nothing got response after touches when using MasterDetailPage on iOS

$
0
0

The application initial load the page using NavigationPage.

MainPage = new NavigationPage(new DeviceListPage());

Later, I added a Master Detail Page into it :

MainPage.Navigation.PushAsync(new DeviceMasterPage());

The selection of the DeviceMasterPage is :

masterPage.ListView.ItemSelected += async (sender, e) =>
        {
          var item = e.SelectedItem as MenuModel;
          if (item != null)
          {
            if (item.TargetType == null)
            {
                await Navigation.PopAsync(true);
            }
            else {
                var page = (Page)Activator.CreateInstance(item.TargetType);
                page.Title = item.Title;

                Detail = new NavigationPage(page);
                Detail.Title = item.Title;

                masterPage.ListView.SelectedItem = null;
                IsPresented = false;
            }
          }
        };

The first Detail Page does show up but touch event not functioning within the detail page (Two aqua button in the image suppose to be slide out when clicked, but nothing happen at the moment). I can swipe back to the previous screen. There is no hamburger icon which was shown on Android but with a text "Device" on it, maybe somewhere in the code replace it ...


CAS Authentication

$
0
0

Hi,

We are currently developing a Xamarin, and we have to handle the authentication throught a CAS server. I don't have a clue how to achieve it...

Does someone already had to use CAS authentication on a Xamarin app, and if so, how can I do that ?

Thanks a lot !

How to add Tutorial screens the first time I open the app after downloading?

$
0
0

As a user I want to see the tutorial screens the first time I open the app after downloading it.Can any one tell me that how to achieve this in xamarin forms application. It's just like a facebook when we install the application it'll popups some screen mainly tutorials and once we skip these screens it'll never appear again in our application.I want to implement same functionality in my application.

System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not

$
0
0

first I started developing Android with C# and Xamarin an week ago, and i'am stuck in this problem.

I already found several texts in stack overflow, but sadly didn't work.

To solve this problem, I took some steps.

(before following things, when I start debug with 'Android_Accelerated_x86 (Android 6.0 -API 23), Visual Studio start find 'NavigationPageRenderer' but is not there then I got message title above)

  1. I installed and updated Packages using Android SDK Manager like following
    Then, I met message wrote on title (System.MissingMethodException: Method 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found)

So, I struggled to find solution and

1) I downloaded JDK 1.8.0_101 and changed path of Java Development Kit Location (in Tools > Option > Xamarin > Android Setting) but it didn't work. (same message like title above)

2) I went to Tools > NuGet Package Manager > Manage NuGet Packages for Solution and updated only Xamarin.Forms v2.3.2.127. Then I got 7 errors (one of them is 'error: package android.support.v7.internal.widget does not exist').

And I deleted the solution and make new project with Xamarin.Forms I got the Warnings message like '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.' and.... I got the message like title above.

Also I got two 'Call Stack'

0x23 in Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnAttachedToWindow at C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:183,4 C#

0xA in Android.Views.View.n_OnAttachedToWindow at /Users/builder/data/lanes/3819/96c7ba6c/source/monodroid/src/Mono.Android/platforms/android-24/src/generated/Android.Views.View.cs:14139,4 C#

please help me to solve this problem.... I already fought this problem for 2 days......

thanks a lot for your attention

How to implement push notification using plugin ("xam.plugin.pushnotification") using xamarin form

$
0
0

Hi,

I implemented push notification using plugin ("xam.plugin.pushnotification") with Google Cloud Messaging(GCM). It's working fine when app is open. When I close the app not receiving GCM messages.

When I search for the solution they are asking to Add Application class and define StartPushService (). After Adding the class my android project throws below error when compile.

Error:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error MSB4018: The "GenerateJavaStubs" task failed unexpectedly.
System.InvalidOperationException: There can be only one type with an [Application] attribute; found: ,
at Xamarin.Android.Tasks.ManifestDocument.CreateApplicationElement(XElement manifest, List1 subclasses, List1 selectedWhitelistAssemblies)
at Xamarin.Android.Tasks.ManifestDocument.Merge(List1 subclasses, List1 selectedWhitelistAssemblies, Boolean embed, Boolean replaceSplashScreen, IDictionary2 splashScreenClasses, String bundledWearApplicationName, IEnumerable1 mergedManifestDocuments)
at Xamarin.Android.Tasks.GenerateJavaStubs.Run()
at Xamarin.Android.Tasks.GenerateJavaStubs.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() (MSB4018) (Preauth.Droid)

Application Class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Runtime;
using PushNotification.Plugin;

namespace Preauth.Droid
{

[Application]
public class ProviderStart : Application
{
    public static Context AppContext;

    public ProviderStart (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer)
    {

    }

    public override void OnCreate ()
    {
        base.OnCreate ();

        AppContext = this.ApplicationContext;

        //TODO: Initialize CrossPushNotification Plugin
        //TODO: Replace string parameter with your Android SENDER ID
        //TODO: Specify the listener class implementing IPushNotificationListener interface in the Initialize generic
        CrossPushNotification.Initialize<CrossPushNotificationListener> ("My google Sender ID");

        StartPushService ();
    }

    public static void StartPushService ()
    {
        AppContext.StartService (new Intent (AppContext, typeof(PushNotificationService)));

        if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Kitkat) {

            PendingIntent pintent = PendingIntent.GetService (AppContext, 0, new Intent (AppContext, typeof(PushNotificationService)), 0);
            AlarmManager alarm = (AlarmManager)AppContext.GetSystemService (Context.AlarmService);
            alarm.Cancel (pintent);
        }
    }

    public static void StopPushService ()
    {
        AppContext.StopService (new Intent (AppContext, typeof(PushNotificationService)));
        if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Kitkat) {
            PendingIntent pintent = PendingIntent.GetService (AppContext, 0, new Intent (AppContext, typeof(PushNotificationService)), 0);
            AlarmManager alarm = (AlarmManager)AppContext.GetSystemService (Context.AlarmService);
            alarm.Cancel (pintent);
        }
    }

}

}

could any one tell me how to solve the issue.

Building 2 line label with truncating in c# source

$
0
0

Hi,

I found the following post to create 2 line labels (by implementing custom rendering for the label):

http://depblog.weblogs.us/2016/06/27/xamarin-forms-multi-line-label-custom-renderer-gotcha/comment-page-1/#comment-132644

Do I have a chance to create the 2-line label in the source code too?

Lets say the following code:

MultiLineLabel ProductName = new MultiLineLabel()
{
FontSize = 12
// BackgroundColor = Color.Red

};
ProductName.SetBinding(Label.TextProperty, “sName”);
ProductName.LineBreakMode = LineBreakMode.TailTruncation;
ProductName.Lines = 2;

The Label shows up but doesnt have 2 lines.. I assume, thats because the custom render method is not been called.

Do you know how that problem may be fixed?

Thank you very much for your help!

Alex

Xamarin Forms: progressbar and its update

$
0
0

A question about progressbar. In my application I have a form where I update a list of people in the database and I want to show a progress bar. For each record I update the progress bar. The problem is the progress bar doesn't show anything. The code is:

double progress = Convert.ToDouble(e.CurrentRecord) / Convert.ToDouble(e.TotalRecord);
await this.progress1.ProgressTo(progress, 250, Easing.Linear);

I tried

this.progress1.Progress = progress;

but the result is the same. Any suggestion? Thank you

[Xamarin.Forms, Android] Context menu of the Editor control is not working in the ListView

$
0
0

Hello,

I have a Xamarin.Forms application. And I have an Editor control in a custon ViewCell in a ListView.

Usually, if a user makes a long press on an Editor control he/she has a text editor context menu (Select All, Copy, Paste and so on).

But if an Editor control is in a ViewCell with ContextActions, then context actions appears when a user makes a long press on an Editor control, not a text editor context menu.

This bug is related to the Xamarin.Forms on the Android platform only. On other platforms it works as expected: a text editor context menu is appearing in all cases.

There is an example code of an Editor control is in a ViewCell with ContextActions:

<ListView.ItemTemplate>

    <ViewCell.ContextActions>
      <MenuItem Text="Show" Command="{Binding ShowCommand}" CommandParameter="{Binding .}" />
      <MenuItem Text="Delete" Command="{Binding DeleteCommand}" CommandParameter="{Binding .}" />
    </ViewCell.ContextActions>

    <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" Padding="16">
      <Label Text="{Binding Name}" HorizontalOptions="FillAndExpand" />
      <Editor Text="{Binding Description}" HorizontalOptions="FillAndExpand" HeightRequest="90" />
    </StackLayout>

  </ViewCell>
</DataTemplate>

</ListView.ItemTemplate>

And there are example screenshots of simple Editor context menu (XF_Android_SimpleEditor_ContextMenu.png) and Editor in List context actions insted of text editor context menu (XF_Android_EditorInList_ContextMenu.png).

Regards,
Aleksandrs Vorobjovs


[Xamarin.Forms, Android] Context menu of the Editor control is not working in the ListView

$
0
0

Hello,

I have a Xamarin.Forms application. And I have an Editor control in a custon ViewCell in a ListView.

Usually, if a user makes a long press on an Editor control he/she has a text editor context menu (Select All, Copy, Paste and so on).

But if an Editor control is in a ViewCell with ContextActions, then context actions appears when a user makes a long press on an Editor control, not a text editor context menu.

This bug is related to the Xamarin.Forms on the Android platform only. On other platforms it works as expected: a text editor context menu is appearing in all cases.

There is an example code of an Editor control is in a ViewCell with ContextActions:

<ListView.ItemTemplate>

    <ViewCell.ContextActions>
      <MenuItem Text="Show" Command="{Binding ShowCommand}" CommandParameter="{Binding .}" />
      <MenuItem Text="Delete" Command="{Binding DeleteCommand}" CommandParameter="{Binding .}" />
    </ViewCell.ContextActions>

    <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" Padding="16">
      <Label Text="{Binding Name}" HorizontalOptions="FillAndExpand" />
      <Editor Text="{Binding Description}" HorizontalOptions="FillAndExpand" HeightRequest="90" />
    </StackLayout>

  </ViewCell>
</DataTemplate>

</ListView.ItemTemplate>

And there are example screenshots of simple Editor context menu (XF_Android_SimpleEditor_ContextMenu.png) and Editor in List context actions insted of text editor context menu (XF_Android_EditorInList_ContextMenu.png).

Regards,
Aleksandrs Vorobjovs

Debug iphone application iPhone device with VPN rest services

$
0
0

Hi ,

We need to debug iphone application in iPhone device with VPN rest services.

Please provide any help.

Thanks,
Sunil Rana

Xamarin Firebase Messaging in Xamarin Forms app

How can I keep the master-detail icon in a Navigation page instead of having a back button?

$
0
0

I have read through a lot of threads on here asking similar things, and I have tried all of the fixes suggested, but nothing I do seems to work. I am pretty sure my code is not that different. I have made the master page (navigation drawer) available on every page, but without an icon to say it is there, it is not very useful to users. It is available only with a gesture.

NavigationMenuMasterDetailPage.cs

using MyApp.Localization;
using MyApp.Statics;
using Xamarin.Forms;

namespace MyApp.Pages.Common
{
    public class NavigationMenuMasterDetailPage : MasterDetailPage
    {
        NavigationMenuMasterPage masterPage;
        NavigationPage _navPage = new NavigationPage();

        public NavigationMenuMasterDetailPage()
        {
            masterPage = new NavigationMenuMasterPage();
            Master = masterPage;
            Detail = _navPage;
            _navPage.PushAsync(new StartPage());

            masterPage.MenuListView.ItemSelected += OnItemSelected;
        }

        void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as MasterPageItem;
            if (item != null && item.Title == TextResources.Settings)
            {
                Detail = _navPage;
                _navPage.PushAsync(new SettingsPage());
            }
            else if (item != null && item.Title == TextResources.Message_Box)
            {
                Detail = _navPage;
                _navPage.PushAsync(new MessageBoxPage());
            }
            else if (item != null && item.Title == TextResources.Login_Log_Out)
            {
                MessagingCenter.Send(this, MessagingServiceConstants.LOGOUT);
            }
            masterPage.MenuListView.SelectedItem = null;
            IsPresented = false;
        }
    }
}

In this page I make the NavigationPage separate so I can also use the back button to go back to the start page, rather than close the app. StartPage displays fine, with the hamburger menu icon as expected.

NavigationMenuMasterPage.xaml

<?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="MyApp.Pages.Common.NavigationMenuMasterPage"
             xmlns:statics="clr-namespace:MyApp.Statics;assembly=MyApp"
             Title="Navigation drawer"
             Icon="hamburger.png">
  <ContentPage.Content>
    <StackLayout VerticalOptions="FillAndExpand">
      <ListView x:Name="menuListView" VerticalOptions="FillAndExpand" SeparatorVisibility="None">
        <ListView.ItemTemplate>
          <DataTemplate>
            <TextCell Text="{Binding Title}" TextColor="{x:Static statics:Palette.Primary}" />
          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
    </StackLayout>
  </ContentPage.Content>
</ContentPage>

NavigationMenuMasterPage.xaml.cs

using MyApp.Localization;
using System.Collections.Generic;
using Xamarin.Forms;

namespace MyApp.Pages.Common
{
    public partial class NavigationMenuMasterPage : ContentPage
    {
        public ListView MenuListView { get { return menuListView; } }

        public NavigationMenuMasterPage()
        {
            InitializeComponent();

            var masterPageItems = new List<MasterPageItem>();
            masterPageItems.Add(new MasterPageItem
            {
                Title = TextResources.Settings,
                TargetType = typeof(SettingsPage)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title = TextResources.Message_Box,
                TargetType = typeof(MessageBoxPage)
            });
            masterPageItems.Add(new MasterPageItem
            {
                Title = TextResources.Login_Log_Out,
            });
            menuListView.ItemsSource = masterPageItems;
        }
    }
}

The problem arises when I go to any page from the Master page, or go further in the flow from the StartPage.

I can post my SettingsPage as an example, but it is extremely basic. All the .cs file does at this point is InitializeComponent();.

SettingsPage.xaml

<?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="HolteApp.Pages.Common.SettingsPage"
             Icon="hamburger.png">
  <Label Text="This will be the settings page." VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

StartPage.xaml

<?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="MyApp.Pages.StartPage"
             xmlns:l10n="clr-namespace:MyApp.Localization;assembly=MyApp"
             xmlns:statics="clr-namespace:MyApp.Statics;assembly=MyApp"
             Icon="hamburger.png">
  <ContentPage.Content>
    <StackLayout VerticalOptions="FillAndExpand"
                 HorizontalOptions="FillAndExpand"
                 Orientation="Vertical"
                 Spacing="0">
      <Label Text="{l10n:Translate Company_Label}"
             TextColor="{x:Static statics:Palette.Primary}"
             Margin ="16, 16, 16, 8"
             FontAttributes="Bold"/>
      <Label x:Name="CompanyNameView"
             Text="{Binding CompanyName}"
             TextColor="{x:Static statics:Palette.PrimaryText}"
             Margin ="16, 8, 16, 8" >
        <Label.GestureRecognizers>
          <TapGestureRecognizer Tapped="CompanyNameClicked" NumberOfTapsRequired="1" />
        </Label.GestureRecognizers>
      </Label>
      <Label Text="{l10n:Translate Projects_Label}"
             TextColor="{x:Static statics:Palette.Primary}"
             Margin ="16, 8, 16, 8"
             FontAttributes="Bold"/>
      <ListView ItemsSource="{Binding Projects}"
                x:Name="ProjectsView"
                ItemSelected="ProjectClicked">
        <x:Arguments>
          <ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy>
        </x:Arguments>
        <ListView.ItemTemplate>
          <DataTemplate>
            <TextCell Text="{Binding ProjectName}" TextColor="{x:Static statics:Palette.PrimaryText}"/>
          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
    </StackLayout>
  </ContentPage.Content>
</ContentPage>

StartPage.xaml.cs

using MyApp.Localization;
using MyApp.Pages.Routines;
using MyApp.ViewModels;
using MyCloudContracts.DTOs;
using System;
using Xamarin.Forms;

namespace MyApp.Pages
{
    public partial class StartPage : ContentPage
    {
        private StartPageViewModel _viewModel;

        public StartPage()
        {
            InitializeComponent();
            Title = TextResources.AppName;
            _viewModel = new StartPageViewModel();
            _viewModel.Init();
            BindingContext = _viewModel;
        }

        private async void ProjectClicked(object sender, SelectedItemChangedEventArgs e)
        {
            //since this is also called when an item is deselected, return if set to null
            if (e.SelectedItem == null)
                return;

            var selectedProject = (CMSProjectInfoDTO) e.SelectedItem;
            var projId = selectedProject.Id;
            var name = selectedProject.ProjectName;
            var handbooksPage = new HandbooksPage(projId, name, false);
            await Navigation.PushAsync(handbooksPage);

            //take away selected background
            ((ListView)sender).SelectedItem = null;
        }

        private async void CompanyNameClicked(object sender, EventArgs e)
        {
            var name = _viewModel.CompanyName;
            var handbooksPage = new HandbooksPage(null, name, true);
            await Navigation.PushAsync(handbooksPage);
        }
    }
}

And then the HandbooksPage comes up, also with the back arrow instead of the master detail icon. I can still access the master page by swiping from the left side of the screen.

Does anybody know what I am doing wrong? I have set the "Icon" attribute on the Master page. I have tried to put my navigation all inside of one Detail page. I really just want to replace the detail page every time, but I need the stack to navigate.

ViewCell in iOS with a Label as ItemTemplate => Problem with LabelRenderer

$
0
0

Hello,

I need help with a Custom ViewCell on iOS:
In my View I have a ListView with some Content (it must be enough Content that I need to scroll)
The ItemTemplate in my Example is only a Label with a Text-Binding and some other settings.
For the Label I have a LabelRenderer to change the FontFamily (in the example I changed it to set the BackgroundColor).
Now when I start my app in iOS and scroll down in the ListView the last Items are not using the Renderer (the first Items are using the Renderer)
In Android and UWP it works fine (with the Android/UWP Renderer).

What can I do to get it working?

Thanks a lot in advance!

My renderer to change the FontFamily/BackgroundColor:

using System;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using CoreGraphics;
using System.Drawing;
using UIKit;
using System.Linq;

[assembly: ExportRenderer(typeof(Label), typeof(Test.iOS.LabelFontRenderer))]
namespace Test.iOS
{
public class LabelFontRenderer : LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs

        if (e.OldElement != null || this.Element == null)
            return;

        //Element.FontFamily = "Archivo Narrow";
  Element.BackgroundColor = Color.Red;
    }
}

}

My View:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace Test.Views
{
public class ListViewTest : ContentView
{
public class Item
{
public Item(string text)
{
Text = text;
}
public string Text { get; set; }
}

    public ListViewTest()
    {
        var data = new List<Item>()
        {
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456"),
            new Views.ListViewTest.Item("Test abc 123.456")
        };


        var list = new ListView()
        {
            HasUnevenRows = true,
            SeparatorVisibility = SeparatorVisibility.None,

            ItemsSource = data,
            VerticalOptions = LayoutOptions.FillAndExpand,
            HorizontalOptions = LayoutOptions.FillAndExpand,

            ItemTemplate = new DataTemplate(() =>
            {
                var viewCell = new ViewCell();
                viewCell.Height = 40;

                var label = new Label()
                {
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions = LayoutOptions.Center,
                    LineBreakMode = LineBreakMode.TailTruncation,
                    FontSize = 16,
                };
                label.SetBinding(Label.TextProperty, new Binding("Text"));
                viewCell.View = label;
                return viewCell;
            })
        };


        this.Content = list;
    }
}

}

Quickstart-guide to start developing with Xamarin(.Forms)

$
0
0

Hi all

I have created a description (.pdf) how to start work with Xamarin(.Forms) and Visual-Studio.
It contains a lot of information's for starters but also information's, like "how to use the forum", some tips and useful links
Table of content:

1 Prologue 3
2 To this document 3
3 My personal experience / opinion to Xamarin(.Forms) 4
4 The “Xamarin environment 6
4.1 Overview (greatly simplified) 6
4.1.1 Description 6
4.1.2 More details, some help… 9
4.1.2.1 … to the MAC-installation 9
4.1.2.2 … to TeamViewer 10
4.1.2.3 … to connect the (HW-)devices 11
4.1.2.4 … to the iOS-emulators 12
4.1.2.5 … to the Android-emulators 13
4.1.2.6 … to the Android-tools 15
4.1.2.7 … to NuGet 17
4.1.2.7.1 Add XLabs to project (VS2013 - Update 2) 17
4.1.2.7.1.1 Initial installation 17
4.1.2.7.1.2 Installing updates automatically 18
4.1.2.7.2 Installing specific versions over the NuGet-Console 19
5 Pre-requisites 22
5.1 Microsoft (Windows Phone) 22
5.2 Apple (iOS) 22
5.3 Google (Android) 22
6 Support / the Xamarin community 23
6.1 Support-Mailbox Xamarin 23
6.2 Support from Xamarin community 23
7 How to use the forum…? 24
7.1 Overview 24
7.2 Your account 25
7.3 Create a thread / post a message 27
7.4 Some other notes 33
7.5 “Like” what you like! 33
7.6 Searching for information’s 34
7.6.1 In the Forum 34
7.6.2 Over google (much better) 34
8 Submit a bug - how to use Bugzilla 38
9 Useful links 40
9.1 Documentation 40
9.1.1 e-book to Xamarin.forms (free) 40
9.1.2 Xamarin.Forms documentation 40
9.1.3 Good kick starter to Xamarin.Forms on the web 40
9.1.4 Get-started page from Xamarin 41
9.1.5 Xamarin Blog 41
9.2 Tools 42
9.2.1 Color-Picker 42
9.3 Add-in’s 42
9.3.1 XLabs (free) 42
9.3.2 Xamarin Component Store (partially free) 42
9.3.3 NuGet 43
9.4 Bugzilla 44
9.5 Xamarin “User voice” 44
10 Special tips for free  45
10.1 Work with your own public variables 45
10.2 Create your own user-controls! 45

Link: http://www.matrixguide.ch/Datenablage/diverses/Quickstart-Guide_Xamarin.pdf

Depending on the feedback I receive here in the thread, maybe I later update / enhance the document

:star:So.. if you are new to Xamarin, you SHOULD have a look...:star:

:smirk:And.. if not... maybe you will find some useful information's nevertheless..:smirk:

Xamarin.Forms UWP NavigationPage issue

$
0
0

Hello,

we currently have a problem with Xamarin.Forms and the Universal Windows Platform.

We have a TabbedPage that has 4 ContentPages, all wrapped in a NavigationPage.
On iOS and Android its displayed properly. On UWP its displayed correctly first (there is a binding error to the title colors of the TabbedPage, so the text is displayed with wrong color), but after navigating to the second page and going back to the first page, the NavigationBar (CommandBar on UWP I guess) just disappears.
This continues till the last page, where the CommandBar stays. Whenever navigating to pages 1 - 3, the CommandBar disappears.

Has anyone noticed behaviour like this? It's really weird and sad, because now we have to adjust behaviour for UWP.

Best,
Chris


can an additional property of a BindableObject derived class be set at xaml?

$
0
0

I implemented an extension class which is derived from BindableObject. In my sample, it's name is LanguageExtension. I added a property Text which dynamically provides text to views by data binding:

<ContentPage ... xmlns:common="clr-namespace:MinimumDemo.Common;assembly=MinimumDemo" ... >

<Label Text="{Binding Text, Source={common:Language}}" />

So far, this works fine.

But now I need to additionally assign a value to a further public property named ID of my LanguageExtension object. I tried coding this:

<Label Text="{Binding Text, Source={common:Language}, ID='abc'}" />

But then an exception is thrown:

Xamarin.Forms.Xaml.XamlParseException: No Property of name ID found

Does anybody know how to assign the value to the addtional ID property at xaml? Or is this not possible? Is there a work around?

Any help is appreciated!

Thanks!

Here is the sample code of the sample extension class:

public class LanguageExtension : BindableObject
{
    public LanguageExtension()
    {
        Text = "en";

        // object triggering this event for test purposes when a button is tapped:
        ILocalize localizer = SimpleIoc.Default.GetInstance<ILocalize>();
        localizer.LanguageChangedProgrammatically += (sener, e) =>
        {
            // toggling language between two test values:
            Text = (Text == "es" ? "en" : "es");
        };
    }

    public static readonly BindableProperty TextProperty =
    BindableProperty.Create("Text", typeof(string), typeof(LanguageExtension), default(string));

    public string Text
    {
        get
        { return (string)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }

    public static readonly BindableProperty IDProperty =
    BindableProperty.Create("ID", typeof(string), typeof(LanguageExtension), default(string));

    public string ID
    {
        get { return (string)GetValue(IDProperty); }
        set { SetValue(IDProperty, value); }
    }
}

Remarks: My goal is to implement a kind of translation mechanism which should be usable by xaml code. As it will be used very often within the app, it's usage should only need a very small amount of code at xaml. And it should not need any further implementation at code behind.

Xamarin.Forms App iOS missing SQLite Wrapper assembly for iOS

$
0
0

Hi,

I developed a Xamarin Forms app with Visual Studio 2013 and it runs great on Android. Now I would like to try it on iOS. I checked the project out on my Mac and opened it in Xamarin Studio. It compiles without complaints but a lot of packages are missing in the iOS project, so I copied all the non-platform-specific-packages from the packages.config of Android to iOS (is there a more elegant way to do this?). That worked, except for the sqlite part. I used SQLitePCLRaw.lib.e_sqlite3.android and SQLitePCLRaw.provider.e_sqlite3.android on Android. For iOS I tried to use SQLitePCLRaw.lib.e_sqlite3.ios_unified and SQLitePCLRaw.provider.e_sqlite3.ios_unified. it compiles without complaints, again, but when I try to run it I get a System.InvalidOperationException as before saying that the platform-specific assembly SQLitePCL.Ext. is missing.

Now I am not sure how to proceed. Any ideas?

Dialog without Navigation bar

$
0
0

Hi
I want to make full screen application, with no navigation and status bars

this is parts of my code (in android main activity)

public static Activity my_act;
protected override void OnCreate(Bundle bundle)
{
    base.OnCreate(bundle);

    my_act = this;  //save activity for static

    View decorView = Window.DecorView;
    var uiOptions = (int)decorView.SystemUiVisibility;
    int newUiOptions = (int)uiOptions;

    newUiOptions |= (int)SystemUiFlags.LayoutStable;
    newUiOptions |= (int)SystemUiFlags.LayoutHideNavigation;
    newUiOptions |= (int)SystemUiFlags.LayoutFullscreen;

    newUiOptions |= (int)SystemUiFlags.HideNavigation;
    newUiOptions |= (int)SystemUiFlags.Fullscreen;
    newUiOptions |= (int)SystemUiFlags.ImmersiveSticky;

    decorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;
    //this code makes full screen application, correct, no questions
}

//but later i need to open the dialog, something like this:
public void ShowDlg()
{
    Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
    {
        Dialog dialog = new Dialog(my_act);
        dialog.Show();
        //after that - i can see empty dialog and dark background and status bar and navigation bar
        //How to make dialog in full screen without dark background ?
    });
}

See images before and after

Could not load assembly Microsoft.Threading.Tasks

$
0
0

Hey,

I am receiving the following error on iOS and Android project. Anybody has any workaround for this issue? This post recommends a workaround but the steps are vague.

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Microsoft.Threading.Tasks.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (Braemar.Vers.Mobile.Droid)

I think that these two paths should have this file but I couldn't find it.
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v1.0

Xamarin Studio:
Version 5.10.2 (build 56)
Installation UUID: 88f72eda-5030-43e9-8d1b-7658e8a17627

Runtime:
Microsoft .NET 4.0.30319.42000
GTK+ 2.24.23 (MS-Windows theme)
GTK# 2.12.30

Xamarin.Android:
Version: 6.0.1.10 (Business Edition)
Android SDK: C:\Android\android-sdk
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1.0 rc1
SDK Build Tools Version: 23.0.2

Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

Build Information:
Release ID: 510020056
Git revision: bb74ff467c62ded42b7b7ac7fdd2edc60f8647b0
Build date: 2016-01-26 15:49:39-05
Xamarin addins: 8b797d7ba24d5abab226c2cf9fda77f666263f1b
Build lane: monodevelop-windows-cycle6-c6sr1

Operating System:
Windows 10.0.10586.0 (64-bit)

Project Information:
PCL 4.5 - Profile 7

how can I use one binding for two column list view?

$
0
0

I already know how to create two column listView but the problem is I can only bind my data source to the whole of the listview and item source, and I can bind them to one column . ( once I bind it to the listview it only can be bind to one side as the bind cannot assign twice )
so how can I bind itemsource to the second column?

Viewing all 77050 articles
Browse latest View live


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