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

System.net.http error in Xamarin.Android

$
0
0

Currently I'm developing Chat app,
and I had install System.net.http for my app,
but when I debug its shown this error in Xamarin.Android.


Xamarin.Forms 2.3.3.180

$
0
0

Important notes

  • Xamarin.Forms 2.3.3 depends on a Xamarin installation of Cycle 8. Users upgrading from Xamarin.Forms 2.3.2 (or earlier) will experience numerous compile errors if they attempt to build without first upgrading their Xamarin installation.

  • When upgrading Xamarin.Forms take care not to simply "update all" as that will update the Xamarin.Android.Support packages to an incompatible version. More info here.

  • In 2.3.3 we are deprecating Classic support (More info here).

Breaking changes

  • [UWP] TabbedPage ContentPresenter is now of type FormsPresenter instead of TabbedPagePresenter. This is an internal change only that will only affect users explicitly targeting TabbedPagePresenter in the UWP project.

2.3.3.180

Nuget package here.

Release Notes

Add authenticode signing.
No other changes.

2.3.3 sr1

Nuget package here.

Bug Fixes

  • 47707 - "47707 – Page.Toolbar is covering page.content with XF.UWP on Windows 10 phone" (PR)

  • 47295 - "[UWP] Toolbar is Clipped When Using a NavigationPage" (PR)

  • 47950 - "2.3.3 Regression: XAML compilation fails with behavior property and StaticResource" (PR)
  • 47971 - "XF UWP ListView Items no longer display" (PR)
  • 48105 - "Xamarin.Forms.Theme ResourceDictionary MergedWith fails in current build" (PR)
  • 48158 - "Hidden controls become transparent, static property does not bind" (PR)
  • 48242 - "Binding to constants not working any more in Xamarin Forms 2.3.3" (PR)
  • 48554 - "Bound static property does not call setter in custom view" (PR)
  • 48726 - "[UWP] Toolbar Covering Page Content" (PR)
  • [XamlC] assigned derived type to generic BP (PR)
  • [Xaml] support non-int enums (PR)

2.3.3 stable

Nuget package here.

Bug Fixes

  • 46195 - "Navigation Stack Errors in Xamarin.Forms.2.3.3.163-pre3" (PR)

2.3.3-pre4

Nuget package here.

Bug Fixes

  • 44338 - "Displaying context action causes ArgumentNullException when another item's context actions are already displayed on iOS10." (PR)

  • "[Win] Toolbar placement works with initial value" (PR)

  • "[Android] SoftInputMode works with initial value" (PR)

2.3.3-pre3

Nuget package here.

Bug Fixes

  • 44129 - "[Forms Android] Removing and adding items to TabbedPage BindingContext crashes the app when VM uses MvvmLight property Set()-method" (PR)

  • 44166 - "41166 - Fix MasterDetailPage/NavigationPage leaks on iPad" (PR)

  • 44596 - "Grey/Blank Screen when switching MainPage to MasterDetail with TabbedPage" (PR)
  • 45010 - "[2.3.3] 45010 – Forms Sample "WorkingWithListview" throw exception with WinPhone8.1" (PR)
  • 44166 - "MasterDetailPage instances do not get disposed upon GC; instance accumulation crashes app with OOM error using Forms 2.3.2.118-pre1 and AppCompat" (PR)
  • Don't unsubscribe/resubscribe the listener to the same INPC (PR)
  • 44886 - "UWP Listview ItemSelected event triggered twice for each selection" (PR)
  • [iOS] Fixes KVO native binding (PR)
  • Make CreateNativeControl virtual instead of abstract (PR)
  • 43993 - "iOS: ListView size does not return to normal after keyboard disappears" (PR)

  • 39768 - "PanGestureRecognizer sometimes won't fire completed event when dragging very slowly" (PR)

  • 42602 - "Custom BoxView Renderer Does Not Render All Its Children Elements" (PR)
  • [Xaml] Xaml native views and bindings for WP8.1 (PR)
  • [XamlC] Compiled converters (PR)
  • [Xaml] allow compatible arguments for x:Factory (PR)
  • [XAMLC] specify type and default value for native bindings (PR)
  • [2.3.3-pre2] [XamlC] supports enum and consts in x:Static (PR)
  • Reuse Handler when invoking on main thread (PR)

2.3.3-pre2

Nuget package here.

New Features

Support native view declaration in Xaml, and native Bindings

The following Xaml is valid, and works as expected:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS"
             xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
             xmlns:formsandroid="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.Platform.Android;targetPlatform=Android"
             xmlns:win="clr-namespace:Windows.UI.Xaml.Controls;assembly=Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime;targetPlatform=Windows"
       x:Class="Xamarin.Forms.Controls.XamlNativeViews">
    <ContentPage.Content>
        <ios:UILabel Text="{Binding NativeText}" View.HorizontalOptions="Start"/>
        <androidWidget:TextView Text="{Binding NativeText}" x:Arguments="{x:Static formsandroid:Forms.Context}" />
        <win:TextBlock Text="Foo"/>
    </ContentPage.Content>
</ContentPage>
  • native views are automagically wrapped into the appropriate wrapper
  • xmlns defined on a non-matching targetPlatform (see TargetPlatform enumeration) are ignored
  • you can bind to property of native views. A proxy is created on the fly for supporting 2-Way bindings if possible. If the native property doesn't implements INPC, or support Observable (on iOS), or is a DependencyProperty (on UWP), you can pass an UpdateSourceEventName parameter to the binding expression.
  • if you set, or bind to, attached BindableProperty to a native view that will be wrapped in a X.F.View, those property values and binding are transferred to the wrapper. See HorizontalOptions in the sample above.

Platform Specifics

Introducing Platform Specifics! Features or behaviors that apply to one platform only can now be implemented without requiring custom renderers. These new features/behaviors can then be accessed easily via a fluent code API or XAML.

Vendors can easily add their own Platform Specifics by attaching Effects to them (see 63a924d and 1f9482e for complete example).

This feature implements the framework that enables the new API and also includes several examples of platform specific features, which can be previewed using the Platform Specifics gallery page:

  • Blur support for any VisualElement on iOS

  • Translucent navigation bar on iOS

  • Partially collapsed navigation bar (with icons!) on MasterDetailPage on Windows
  • Toolbar placement options on Windows
  • AdjustResize/AdjustPan on Android (known issue: AdjustResize disables status bar color)

Bug Fixes

  • 32733 - "32733 – Switching Activity crash in 1.4.4.6392" (PR)

  • 35132 - "35132 – Pages are not collected when using a Navigationpage"

  • 39768 - "PanGestureRecognizer sometimes won't fire completed event when dragging very slowly" (PR)
  • 39908 - "Back button hit quickly results in jumbled pages" (PR)
  • 41463 - "CarouselView Crashes with "Sequence Does not Contain a Matching Element""
  • 42061 - "App crashes when registering an app link entry with invalid thumbnail url" (PR)
  • 42112 - "42112 - CarouselView throws error on Android while moving"
  • 42341 - "Page not removed from NavigationStack when hit Back quickly on iOS" (PR)
  • 42519 - "Text Truncation in UWP"
  • 42697 - "Slow swipe - System.InvalidOperationException: Sequence contains more than one element [CarouselView]"
  • 43230 - "DisplayAlert returns unexpected value when Escape key hit on UWP" (PR)
  • 43328 - "DisplayActionSheet() double-tap NullReferenceException crash Win8.1" (PR)
  • 43354 - "Button IsEnabled binding is position dependent" (PR)
  • 43450 - "Faulty syntax of Grid.RowDefinition wasn't caught with XamlC"
  • 43516 - "[UWP] Changing FontAttribute on a label to NONE changes font size as well" (PR)
  • 43530 - "[Android] Resuming app throws IllegalStateException from fragment manager"
  • 43726 - "Setting TabbedPage.ItemsSource to Null Causes Crash" (PR)
  • 43774 - "Appearing does not trigger for the first time for Tabpages in Android" (PR)
  • 43892 - "Xamarin.Forms.TabbedPage with FormsAppCompatActivity OnAppearing Troubles"
  • 44056 - "Picker Focused/Unfocused events not fired on iOS 10 preview" (PR)

Other fixes

  • iOS10 fixes

2.3.3-pre1

Only internal. There were no public artifacts/nuget packages for pre1.

How to change the status Bar color in Xamarin Forms IOS ?

$
0
0

I want to move from Master Detail Page to Navigation Page Everything works fine.I've a button on Navigation Page when we pressed this button A PushModalAsync is called and the text color changes from white to black.
Now what I want to ask you is that from the PushModalAsync page how to change the status bar color ?

Xamarin.Forms animations

$
0
0

Hey!

I have an app with some animations that happen at the same time. This is causing the animations to lag sometimes, which is not good.
I've been searching if those animations, made using the Animation class from xamarin forms, run on the GPU and if not if it is possible to make them run on it.

Anyone with some experience on this?

Thanks!

Xamarin.Firebase Not Compatible With Forms?

$
0
0

Trying to install Xamarin.Android and it appears that yet again Forms is restricting package dependencies:

Attempting to gather dependency information for package 'Xamarin.Firebase.Messaging.32.961.0' with respect to project 'IntelliDrive.Droid', targeting 'MonoAndroid,Version=v6.0'
Attempting to resolve dependencies for package 'Xamarin.Firebase.Messaging.32.961.0' with DependencyBehavior 'Lowest'
Unable to find a version of 'Xamarin.GooglePlayServices.Basement' that is compatible with 'Xamarin.Firebase.Common 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.Firebase.Iid 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.Firebase.Messaging 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.GooglePlayServices.Base 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Gcm 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Iid 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.GooglePlayServices.Maps 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Measurement 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Tasks 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)'.

It requires a higher version of GooglePlayServices.Basement which can't be upgraded due to what Xamarin.Forms requires. Has anyone else managed to get Firebase working with XF? Or any word when there will be an update to it so we can work with newer technologies?

Showing empty view when ListView is empty in Xamarin.Forms

$
0
0

Is there a way to replicate this in forms?I want to show a message like "empty list" when listveiw is empty.

Search Bar OR Autocomplete for Xamarin Forms

$
0
0

Hi all,

We are working on sample application (using Xamarin forms with MVVM Pattern Logic ). One of our requirement is to type a text in AutoComplete Control and populate the data based on the typed text of a user from WCF Service.

For this we are checking on Search Bar OR Autocomplete control. We have downloaded and checked the below Sample applications and getting the below response.

1) Search Bar: EmployeeDirectory - Deployment error occurred as "Deployment failed because of an internal error: Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]"

2) Xamarin Labs AutoComplete: XF.Labs.Sample - This application build and run successfully but AutoComplete page is not populated(Page is not loaded).

Kindly provide us few sample application links to achieve the same or guide us to achieve our expected result.

How to change Navigation Bar Color

$
0
0

Here is my code:

public partial class MainPage : MasterDetailPage
{
        public MainPage()
        {
                Detail = new NavigationPage(new RootPage());
        }
}

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage Title="Root" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="my.RootPage">
    <ContentPage.ToolbarItems>
        <ToolbarItem   Name="Refresh" Icon="" Activated="OnRefresh" />
    </ContentPage.ToolbarItems>

    <ContentPage.Content >
        <StackLayout >
            ...
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

How do i change so that I can change the Page's background color including the Toolbar as well?


How to Manage Videos in xamarin.forms MVVM

$
0
0

hi all, in my application i want to implement video player that play video on phone. please give some suggestion how Web API Should be create and how should i play in device either Webview or Should i create a player

Xamarin.Forms Bindable Picker

$
0
0

If anyone wonders how to make a Bindable Picker, here's the code:

`

public class BindablePicker : Picker
{
    #region Fields

    //Bindable property for the items source
    public static readonly BindableProperty ItemsSourceProperty =
        BindableProperty.Create<BindablePicker, IEnumerable>(p => p.ItemsSource, null, propertyChanged: OnItemsSourcePropertyChanged);

    //Bindable property for the selected item
    public static readonly BindableProperty SelectedItemProperty =
        BindableProperty.Create<BindablePicker, object>(p => p.SelectedItem, null, BindingMode.TwoWay, propertyChanged: OnSelectedItemPropertyChanged);

    #endregion

    #region Properties

    /// <summary>
    /// Gets or sets the items source.
    /// </summary>
    /// <value>
    /// The items source.
    /// </value>
    public IEnumerable ItemsSource
    {
        get { return (IEnumerable)GetValue(ItemsSourceProperty); }
        set { SetValue(ItemsSourceProperty, value); }
    }

    /// <summary>
    /// Gets or sets the selected item.
    /// </summary>
    /// <value>
    /// The selected item.
    /// </value>
    public object SelectedItem
    {
        get { return GetValue(SelectedItemProperty); }
        set { SetValue(SelectedItemProperty, value); }
    }

    #endregion

    #region Methods

    /// <summary>
    /// Called when [items source property changed].
    /// </summary>
    /// <param name="bindable">The bindable.</param>
    /// <param name="value">The value.</param>
    /// <param name="newValue">The new value.</param>
    private static void OnItemsSourcePropertyChanged(BindableObject bindable, IEnumerable value, IEnumerable newValue)
    {
        var picker = (BindablePicker)bindable;
        var notifyCollection = newValue as INotifyCollectionChanged;
        if (notifyCollection != null)
        {
            notifyCollection.CollectionChanged += (sender, args) =>
            {
                if (args.NewItems != null)
                {
                    foreach (var newItem in args.NewItems)
                    {
                        picker.Items.Add((newItem ?? "").ToString());
                    }
                }
                if (args.OldItems != null)
                {
                    foreach (var oldItem in args.OldItems)
                    {
                        picker.Items.Remove((oldItem ?? "").ToString());
                    }
                }
            };
        }

        if (newValue == null)
            return;

        picker.Items.Clear();

        foreach (var item in newValue)
            picker.Items.Add((item ?? "").ToString());
    }

    /// <summary>
    /// Called when [selected item property changed].
    /// </summary>
    /// <param name="bindable">The bindable.</param>
    /// <param name="value">The value.</param>
    /// <param name="newValue">The new value.</param>
    private static void OnSelectedItemPropertyChanged(BindableObject bindable, object value, object newValue)
    {
        var picker = (BindablePicker)bindable;
        if (picker.ItemsSource != null)
            picker.SelectedIndex = picker.ItemsSource.IndexOf(picker.SelectedItem);
    }

    #endregion
}

`

Usage is pretty straight forward..:

<local:BindablePicker ItemsSource="{Binding Cats}" SelectedItem="{Binding SelectedCat}"/>

It would've been nice that the Xamarin.Forms.Picker already had this functionality, maybe we'll see it in a next update...

Any questions, comments, or contributions are welcome :)

Changing virtual keyboard in Android

$
0
0

Hi, in my Entry control I am setting Keyboard="Numeric". On some of my customers devices, a nice numeric keyboard comes up and doesnt take up much space and is draggable. On others, its bulky, cant be moved and causes layout issues. I am guessing this is down to Android versions but how to I change it? I have tried changing the keyboard in settings on the tablet but no luck. So can anyone tell me where this virtual keyboard comes from?! Or can I change the entry code to look at another numeric keyboard?

DatePicker - MaximumDate failing for last day

$
0
0

Hi there,

I need to set the Maximum Date for a datepicker in my app and for some devices in Android (we have tested in 10 devices and 2 of them have this issue) the last date cannot be picked even though the colour would suggest the date is available. Until now it was only with our client, but today I got an older mobile here and changed the timezone, date and time and it also happens (XPeria Android 5.1.1).

Anyone else had similar problem?

I have tried different ways,

CoverStartsPicker.SetValue(DatePicker.MaximumDateProperty, DateTime.Now.AddDays(3));

I also tried to add a behavior, and set the maximum date there:

void OnFocused(object sender, FocusEventArgs e)
{
DatePicker datePicker = sender as DatePicker;

            if (datePicker == null)
                throw new Exception("ExtendedEntry.OnUnfocused sender == null");

            DateTime maximumDate = System.DateTime.Today.ToLocalTime().AddDays(3);

    datePicker.MaximumDate = maximumDate;

    }

Thank you!

Why do I get this InvalidCastException Android.Support.Design.Widget.TabLayout

$
0
0

System.InvalidCastException: Unable to convert instance of type 'Android.Support.Design.Widget.TabLayout' to type 'Android.Support.V7.Widget.Toolbar'.

I'm getting this error and I'm not sure why. It seems to not like something here(all gen code, I haven't added anything here):

` [Activity(Label = "MyApp", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.tabs;
ToolbarResource = Resource.Layout.toolbar;

        base.OnCreate(bundle);

        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());
    }
}`

"Data at the root level is invalid. Line 1, position 1."

$
0
0

This error appears when trying to view the Main.axml in Visual Studio. It's a new, untouched project.

My XML is valid, as far as I can tell, and I have not changed it in any way. There are no strange characters to be found when inspecting the file.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
<Button
    android:id="@+id/MyButton"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/Hello"
    />
</LinearLayout>

I am able to compile this default app to android, but I am more interested in actually editing it. How do I fix it?

Thanks.

Having difficulty getting a Grid inside a ScrollView to work.

$
0
0

Hi All,

Maybe this is very easy but I cannot seem to get this XAML to work. Basically the goal is to handle landscape orientation on devices easily. I seem to be missing something very simple. Unfortunately I can only see examples where a StackLayout is being used instead of a Grid - could this be the reason?

Any thoughts on the matter? All help here is greatly appreciated.

Regards,
Intelligence4


Context Actions command binding with parameter

$
0
0

Hello,

I am trying to implement a swipe to delete:

                  <ViewCell.ContextActions>
                    <MenuItem Command="{Binding Delete}"
                              CommandParameter="{Binding .}"
                              Text="{i18n:Translate Delete}"
                              IsDestructive="True" />
                  </ViewCell.ContextActions>

But, being it a list of MyObject, the output says that Delete was not found in MyObject. But it should be in the viewmodel.
How can i fix this?

Thanks!

CarouselView 2.3.0-pre2

$
0
0

Xamarin.Forms.CarouselView

News

CarouselView is now open source:
https://github.com/xamarin/Xamarin.Forms.CarouselView

2.3.0-pre2

bugs fixed

  • 41463 - "CarouselView Crashes with "Sequence Does not Contain a Matching Element'"

  • 40513 - "Adding views to CarouselView after rendered and swiping crashes Forms"

Other fixes

Reduced assemblies referenced per platform project from three to one so
that now each platform gets its own version of Xamarin.Forms.CarouselView
into which the portable library has been merged.

For example, Android used to referenced:
  Xamarin.Forms.CarouselView
  Xamarin.Forms.CarouselView.Platform
  Xamarin.Forms.CarouselView.Android

But now only references:
  Xamarin.Forms.CarouselView (android specific)

2.3.0-pre1

Nuget package

Notes

Creating this thread to collect all CarouselView feedback until it is merged back into the Xamarin.Forms package.
James Montemagno put together a post on CarouselView here

CarouselView OutOfMemoryError

$
0
0

I am using a a CarouselView as a wizard type layout for entry for multiple different types of information. If there are a lot of pages in the carousel and the user swipes back and forth a lot, I get an OutOfMemoryError. How do I keep this from happening?

java.lang.OutOfMemoryError: Failed to allocate a 12538892 byte allocation with 6804128 free bytes and 6MB until OOM

[Xamarin.Forms] CarouselPage Swipe Animation

$
0
0

Using a PCL project I implemented a simple Application using Carousel Page. The swipe animation works fine on iOS (considering the speed of swiping), however when it comes to Android the animation doesn't seem to work if I speed up the gesture I end up with a view replacing another without any animation. In addition I receive this message :

** W/OpenGLRenderer( 5533): Incorrectly called buildLayer on View: LinearLayout, destroying layer...**

DependencyService not working (iOS 10.2, XF v2.3.3.180)

$
0
0

Hi,
I have an issue that the DependencyService is not working in iOS, while the same works perfectly in Andorid and UWP.

Example code:

using System.IO;
using Foundation;

[assembly: Xamarin.Forms.Dependency(typeof(FontHelper))]

namespace Controls.iOS
{
    public sealed class FontHelper : IFontHelper
    {
        public string GetFontPath(string fontName)
        {
            var fileName = Path.GetFileNameWithoutExtension(fontName);
            var extension = Path.GetExtension(fontName);
            return NSBundle.MainBundle.PathForResource(fileName, extension);
        }
    }
}

When calling var fontHelper = DependencyService.Get<IFontHelper>(); I only get a null result.

Registering the service manually in AppDelegate.OnActivated(UIApplication uiApplication) did not help either. I tried this variants:

DependencyService.Register<IFontHelper, FontHelper>();
DependencyService.Register<FontHelper>();

The same problem applies to ViewRenderer, which are declared as follows:

[assembly: Xamarin.Forms.ExportRenderer(typeof(TestView), typeof(TestViewRenderer))]

namespace Controls.iOS
{
    [Preserve(AllMembers = true, Conditional = false)]
    public sealed class TestViewRenderer : ViewRenderer<TestView, UIView>
    {
        [Preserve]
        public TestViewRenderer()
        {
        }
    }
}
  • According to the documentation this can happen in UWP when using Native Compilation, but shouldn't happen in iOS.
  • The setting Linker behavior is set to Don't link.
  • A Xamarin.Forms.Forms.Init(string[] assemblies) method seems to be missing. However, the Application Output (NSLog) confirms that all necessarily assemblies got loaded.
  • A imperatively method for registering ViewRenderer and EntryRenderer seems to be missing. There is only the declarative method using the ExportRendererAttribute.
  • When resolving the renderer, I get the Xamarin-renderer for the base class. So the resolving appears to work, while the registering of custom types seems to be the problem.

I am wondering if this is a problem with the DependencyService or an mistake in the documentation.

Viewing all 91519 articles
Browse latest View live


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