Xamarin.Forms 1.4.0 Released

TheRealJasonSmithTheRealJasonSmith XamuraiUSXamarin Team Xamurai

Same as -pre2 with an additional bug fix for Android ContextActions.

Important Notes

This is a feature release. As such unlike a patch version bump, the minor version bump indicates the inclusion of new APIs.

New API

ScrollView

It is now possible to detect the current scroll offset of the ScrollView. These are readonly bindable properties.

public double ScrollX { get; }
public double ScrollY { get; }

There are also methods which can be used to perform scrolling in the ScrollView.

public Task ScrollToAsync (double x, double y, bool animated);
public Task ScrollToAsync (Element element, bool animated);

The Element passed to ScrollToAsync must be a descendant of the ScrollView but does not have to be a direct child.

Finally for those who do not wish to use bindings to observe scrolling, there is a Scrolled event that fires when ScrollX or ScrollY are updated.

public event EventHandler<ScrolledEventArgs> Scrolled;

public class ScrolledEventArgs : EventArgs
{
    public double ScrollX { get; } = 0;
    public double ScrollY { get; } = 0;
}

Lastly ScrollView no longer uses any internal API to communicate between the frontend and the renderer. IScrollViewController, which is implemented explicitly on ScrollView can be used to trigger these and other events.

ListView

Separator Enhancements
It is now possible to enable/disable separators for the ListView. This can be configured via the SeparatorVisibility property, which is bindable.

public SeparatorVisibility SeparatorVisibility { get; set; } = SeparatorVisibility.Default;

public enum SeparatorVisibility {
    Default = 0,
    None = 1,
}

Currently there is no option for Always as not all platforms have separators as part of their UX. We are considering adding this in the future, however it would be an invented paradigm for Windows platforms.

It is now possible to apply a Color to the separator in ListView.

public Color SeparatorColor { get; set; } = Color.Default;

The default value is Color.Default and will function unchanged from the 1.3.0 implementation if left untouched. RGBA values are supported. This function does nothing in SeparatorVisibility is set to None. Please note that setting either of these properties on Android after loading the ListView incurs a large performance penalty.

Header/Footer
ListView has also grown both a Header and a Footer. These are managed through a series of properties which enable everything from simple usage to more complex MVVM style usage. With Header/Footer the primary reason developers have in the past been forced to put ListViews inside of ScrollViews is finally dead! If you are still placing a ListView inside a ScrollView we strongly suggest you consider porting.

public object Header { get; set; } = null;
public DataTemplate HeaderTemplate { get; set; } = null;
public object Footer { get; set; } = null;
public DataTemplate FooterTemplate { get; set; } = null;

It is important to note that Header or Footer may be set directly to a View and the Template properties left null. This will cause the Header/Footer to be directly consumed by the renderer. All of these properties are bindable.

Pull To Refresh
PullToRefresh has been enabled on all current target platforms for ListView. To enable PullToRefresh in your app simple set IsPullToRefreshEnabled to true and make sure you respond to the correct events. It is important to note that this is the "easy" version of this API, in the future a more complete API with a standalone View may be added.

public event EventHandler Refreshing;

public bool IsPullToRefreshEnabled { get; set; } = false;
public bool IsRefreshing { get; set; } = false;
public ICommand RefreshCommand { get; set; } = null;

public void BeginRefresh ();
public void EndRefresh ();

When the user triggers a PullToRefresh the Command will be invoked and the Refreshed event emitted. IsRefreshing will be set to true. The ICommand.CanExecute property is respected. The user must either call EndRefresh or assign IsRefreshing to false in order to end the refresh state.

All control parameters for these features and more are exposed through the IListViewController interface, which is explicitly implemented on ListView. This will assist those wishing to modify how these features work in custom renderers.

The Windows Phone implementation of PullToRefresh is a custom implementation as there is no platform idiom for doing this. In the future if the Windows platform decided to add a method of doing PullToRefresh by default, we intend to port.

Forms.Application

The Application class now exposes 4 new events for dealing with Modal navigation.

public event EventHandler<ModalPushedEventArgs> ModalPushed;
public event EventHandler<ModalPoppedEventArgs> ModalPopped;
public event EventHandler<ModalPushingEventArgs> ModalPushing;
public event EventHandler<ModalPoppingEventArgs> ModalPopping;

The ModalPoppingEventArgs contains a Cancel property which if set to true will cancel the Pop event and cause the application to enter the background (the operating system is informed of the unhandled back event).

In order to implement this feature, all pre-Application methods of creating a Forms app have been updated to create a default Application which is set as the root pages Parent. It is possible this may cause issues in some edge cases, if you have any issues please file a bug report. It is suggested you update your app to the new LoadApplication initialization methodology if possible.

Application now has a method of manually forcing the Properties dictionary to be saved to the IsolatedFileStore. This is to allow users to save their properties when it makes sense for them rather than risk them not getting serialized out due to a crash/being killed by the OS.

public Task SavePropertiesAsync ()

OpenGLRenderer

On Android OpenGLRenderer has been renamed OpenGLViewRenderer for consistency.

Layout

Layout now contains a ILayoutController class which has an IReadOnlyList<Element> which can be used to enumerate the children of a Layout regardless of the type of the Layout.

Other Features

  • WebView now correctly supports javascript out of the box on Windows Phone 8.0

Bug Fixes

  • Bug 27063 - Navigation not always returning to the proper page.
  • Bug 27225 - Secondary ToolbarItems cause app to hang during PushAsync
  • Bug 27437 - [iOS] Context menu error after deleting an item from a ListView using ContextActions
  • Bug 27096 - EntryCell has different fontsize on Android
  • Bug 21317 - Stepper control .IsEnabled doesn't work on Android
  • Bug 26338 - Unable to change page BackgroundImage from code
  • Bug 26588 - [WinPhone] Entry does not trigger numeric keyboard when password masking is enabled
  • Bug 27072 - Listview Context Actions not removed if a different item is tapped in Android

Other Fixes

  • Stepper default values now can be correctly inherited through a style.
  • x:Static now correctly reports position on error in XAML.
  • XAML now throws a more user friendly error on duplicate x:Name
  • XAML will now use implicit operators when assigning values to properties
  • XAML now supports baseclass indication for collection properties
  • XAML string literals are now supported with {}foo
  • iOS6 Modal pages should no longer sometimes have a 20px offset for no reason
«1

Posts

  • congqiangcongqiang USMember

    I am glad to see Xamarin.Forms is growing, pulltorefresh.., when can we see professinal Tabpage, slidingpage and visiable design?

  • DerekPapworth.4183DerekPapworth.4183 ✭✭ GBMember ✭✭

    Nice one Jason - great work as always!

  • NicolasKrierNicolasKrier ✭✭✭ FRMember ✭✭✭

    Awesome :D

  • MihaiCvasnievschiMihaiCvasnievschi USUniversity

    Might be something on my machine but when I try to compile the Android part of a Xamarin.Forms project and Static Link the SDK I get this:

    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Void Android.Widget.AbsListView::SetSelectionFromTop(System.Int32,System.Int32)' (defined in 'Xamarin.Forms.Platform.Android, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Platform.Android, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Widget.AbsListView::SetSelectionFromTop(System.Int32,System.Int32)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue()
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process()
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: --- End of inner exception stack trace ---
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute()
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    13>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1017,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()

  • venuvenu USMember

    Awesome. I love ListView feature updates. However, I could see one breaking issue on the ListView. I used to set (sender as ListView).SelectedItem=null to avoid selection color in the listview. But, now it breaks. Always first item getting selected background(some blue color) even If I set null in the event. Also first Item always getting selected background color even if I select other items. Anything wrong?. Any new property available to avoid selection background?

  • MartinBoothMartinBooth ✭✭ USMember ✭✭

    I think there is an issue (probably introduced in a previous version) with HasUnevenRows being set to true on IOS (at least).

    The ItemAppearing event fires for all items in the list even if they haven't appeared (presumably because they're loaded in order to measure them)

    The problem is though that this breaks my infinite scrolling which I think is the main usecase for the ItemAppearing event.

    Please let me know if you can't reproduce this because there's always a chance the situation is more complicated that I have described in which case I'll try to find out why I am seeing this behaviour

  • venuvenu USMember

    @Mihai Cvasnievschi : I am also facing same issue.

  • Thinking-SoftwareThinking-Software GBMember

    I'm also noticing the same issue as @MartinBooth (Also on IOS)

  • ScottSmith.8058ScottSmith.8058 USMember, University

    How do you perform a pull to refresh using the Windows Phone emulator? I've tried the swipe down motion that works in iOS and Android, but it does not seem to work for WinPhone. I'm not all that familiar with WinPhone gestures, so I am sure that is the issue. The new pull to refresh works great in iOS and Android!! Nice addition.

  • Shane000Shane000 ✭✭✭ USMember ✭✭✭

    Updated to 1.4.0 and started getting a crash w/ relativelayout in the xaml. Haven't touched that file and it worked fine before

    Xamarin.Forms.Xaml.XamlParseException: Type ConstraintExpressionExtension not found in xmlns 
      at Xamarin.Forms.Xaml.XamlParser.GetElementType (Xamarin.Forms.Xaml.XmlType xmlType, IXmlLineInfo xmlInfo, System.Reflection.Assembly currentAssembly) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.XamlTypeResolver.Resolve (System.String qualifiedTypeName, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.XamlTypeResolver.TryResolve (System.String qualifiedTypeName, System.Type& type) [0x00000] in <filename unknown>:0
    
  • JamesMontemagnoJamesMontemagno Xamurai USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
    edited March 2015

    Just blogged on the pull to refresh goodness: http://motzcod.es/post/113280718807/official-pull-to-refresh-in-xamarin-forms-1-4-0

    WP is the same, a pull down to refresh

  • ScottSmith.8058ScottSmith.8058 USMember, University

    I am seeing that pull to refresh on WP only seems to work when there are more rows than can fit on one screen. If, for example, there are only two items in the list view, pulling down on the list does not seem to work. I have tried setting the list views layout options (horizontal and vertical) to FillAndExpand. Also tried as the only control on the page and inside a StackLayout. Is this a bug, or am I missing something?
    Thanks

  • MikeEEEMikeEEE ✭✭✭ USMember ✭✭✭

    @ShanePope this is a known issue if you have your code set to break on a XamlParseException. You should be able to continue and it will work as expected. I was able to upgrade to 1.4.0 and load a RelativeLayout Xaml with ConstraintExpressionExtension just fine (but with lots of messages in the debugger).

    My guess is that you at some point set your debugger to break on XamlParseException and that is why you are seeing the error now. I could be wrong, though. :)

    Here's the bug: https://bugzilla.xamarin.com/show_bug.cgi?id=27730

  • Shane000Shane000 ✭✭✭ USMember ✭✭✭

    @MikeEEE thanks, Something else was crashing and I just managed to hit that first when I turned on all exceptions.

    The actual crash is that my converter stopped working: <Label Text="{Binding DateOfBirth, Converter={StaticResource DOBLabelConverter}}"/> It was fine before, I assume it has something to do with the 1.4.0 xaml / static changes?

    I am defining and referencing the converter inside the resource dictionary. Could that be a problem? It worked in 1.3.5
    <ResourceDictionary> <converters:DOBLabelConverter x:Key="DOBLabelConverter"/> ......

    System.Exception: Position 35:36. StaticResource not found for key DOBLabelConverter
      at Xamarin.Forms.Xaml.StaticResourceExtension.ProvideValue (IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x00000] in <filename unknown>:0
      at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[ComposeMessagePage] (Company.Mobile.Pages.ComposeMessagePage view, System.Type callingType) [0x00000] in <filename unknown>:0
      at Company.Mobile.Pages.ComposeMessagePage.InitializeComponent () [0x0000c] in /Users/shane/GitHub/Company.Mobile/Company.Mobile/obj/Debug/ComposeMessagePage.xaml.g.cs:44
    [clipped]
    
  • MartinBoothMartinBooth ✭✭ USMember ✭✭

    @PeteGiles.2978

    I have filed a bug (27845) for this issue. I will take a look to see whether I can come up with a workaround this evening

  • MikeEEEMikeEEE ✭✭✭ USMember ✭✭✭

    @ShanePope ... hmm... not sure. I would have to see the entire Xaml to be sure. Are they in the same file? I of course prefer using singleton instances for my converters... saves a lot of work and you're not having to chase down ResourceDictionary entries half the time. You might want to try that to see if it fixes your problem. Here's an example of setting one up:
    https://github.com/Michael-DST/xamarin-forms-samples/blob/master/FormsGallery/FormsGallery/FormsGallery/Support/LuminosityConverter.cs#L9

    Usage in Xaml:
    https://github.com/Michael-DST/xamarin-forms-samples/blob/master/FormsGallery/FormsGallery/FormsGallery/AbsoluteLayoutDemoPage.xaml#L9

  • Shane000Shane000 ✭✭✭ USMember ✭✭✭
    edited March 2015

    Thanks @MikeEEE, referencing like that fixed it. So 1.4.0 introduced a bug where if you define a converter in your xaml resource dictionary, and then reference it below (in my case a viewcell datatemplate). It can't find the converter.

    Filed here: https://bugzilla.xamarin.com/show_bug.cgi?id=27863

    <ResourceDictionary>
             <converters:DOBLabelConverter x:Key="DOBLabelConverter"/>
             <DataTemplate x:Key="listDataTemplate">
                    <ViewCell>
                      <ViewCell.View>
                        <AbsoluteLayout Padding="5, 5, 5, 5">
                            <Label Text="{Binding Name}"
                                   AbsoluteLayout.LayoutBounds="42,0,1,25"
                                   AbsoluteLayout.LayoutFlags="WidthProportional"/>
    
                            <RelativeLayout AbsoluteLayout.LayoutBounds="42,25,1,25"
                                            AbsoluteLayout.LayoutFlags="WidthProportional">
    
                                <Label Text="{Binding DateOfBirth, Converter={StaticResource converters:DOBLabelConverter}}"
                                       LineBreakMode="TailTruncation"
                                       RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                                       RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=5}"/>
    

    System.Exception: Position 35:36. StaticResource not found for key DOBLabelConverter
    at Xamarin.Forms.Xaml.StaticResourceExtension.ProvideValue (IServiceProvider serviceProvider) [0x00000] in :0
    at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00000] in :0
    at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x00000] in :0
    at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x00000] in :0
    at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[ComposeMessagePage] (Company.Mobile.Pages.ComposeMessagePage view, System.Type callingType) [0x00000] in :0
    at Company.Mobile.Pages.ComposeMessagePage.InitializeComponent () [0x0000c] in /Users/shane/GitHub/Company.Mobile/Company.Mobile/obj/Debug/ComposeMessagePage.xaml.g.cs:44
    [clipped]

  • KriZoltnKriZoltn USMember

    BindingContext of Footer in Listview is null from xaml:

    <ListView ...>
    <ListView.Footer>
    <Label Text="Loading..." IsVisible="{Binding IsLoading}" />
    </ListView.Footer>
    </ListView>
    

    Does not work, because BindingContext in the label is null (but the page has one). Is this a bug and is there a way in xaml to set it to the parent's view? Like BindingContext="{Binding ParentView.BindingContext}" (does not work) - without using code-behind file

  • MikeEEEMikeEEE ✭✭✭ USMember ✭✭✭
    edited March 2015

    @ShanePope: Weird, that's good to know. That should still resolve since it's in the logical hierarchy. Is this code somewhere where I could try to help verify and possibly submit a bug if so?

  • Shane000Shane000 ✭✭✭ USMember ✭✭✭

    @MikeEEE I tried to write a sample app to reproduce it that I could share but it didn't crash. Definitely was a 1.4.0 regression but I can't spend more time looking into why right now. Thanks again for the workaround.

  • KriZoltnKriZoltn USMember

    Even worse, in the above code, if I set the BindingContext in the code-behind file, the footer does not get resized when IsVisible of the label changes (Android). The place/height of the label is always there at the end of the list. So how is this supposed to be used? Is this only a "static" footer which should not be changed after initialized?
    Tried to set footer after the loading operation to null, but for that I get an exception:

    [MonoDroid] UNHANDLED EXCEPTION:
    [MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
    [MonoDroid] at Xamarin.Forms.Platform.Android.ListViewRenderer/Container.OnMeasure (int,int)
    [MonoDroid] at Android.Views.View.n_OnMeasure_II (intptr,intptr,int,int) [0x00009] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-16/src/generated/Android.Views.View.cs:12274
    [MonoDroid] at (wrapper dynamic-method) object.4f5eb468-bce0-4fbe-8865-c7a37e82f01b (intptr,intptr,int,int)

  • PerReitzelPerReitzel ✭✭ DKMember ✭✭

    @TheRealJasonSmith .. I have a page with a lot of fields (and therefore requiring a scrollview) where all fields are disabled .. then on WP you cannot scroll. It Works fine on both Android an iPhone.

    And this used to work fine in previous version of XF.

    Is that a known issue?

    Also .. I'm still not able to disable an Editor control on iOS. Yes .. in a ScrollView. :-)

    /per

  • MihaiCvasnievschiMihaiCvasnievschi USUniversity

    Not sure if it's something within my project by I'm trying to use ListView's ScrollTo to scroll to the top of the list and any attempts I had at getting it working failed.

    This is the exception I get:
    "Argument is out of a range.\n Parameter name: index"

    Stack trace:
    0x21 in System.Diagnostics.Debugger.Mono_UnhandledException_internal C#
    0x1 in System.Diagnostics.Debugger.Mono_UnhandledException C#
    0x3E in object.6dde6d35-951e-47b4-b4fb-d994267d69e1 C#
    0x15 in Xamarin.Forms.ListProxy.get_Item C#
    0x9 in Xamarin.Forms.TemplatedItemsList<Xamarin.Forms.ItemsView<Xamarin.Forms.Cell>,Xamarin.Forms.Cell>.get_Item C#
    0xB1 in Xamarin.Forms.Platform.Android.ListViewRenderer.OnScrollToRequested C#
    0x1D in Xamarin.Forms.Platform.Android.ListViewRenderer.OnLayout C#
    0x12 in Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII C#

    Current code:

    Device.BeginInvokeOnMainThread(() =>
    {
    try
    {
    list.ScrollTo(null, ScrollToPosition.Start, false);
    }
    catch { }
    });

    Called from OnAppearing ...

    Please note I've also tried by passing the first item with same result. Anywaym, I would expect ScrollTo position to work without passing an item if one wants to scroll to beginning of list.

  • Mobile_DanMobile_Dan ✭✭ USMember, Beta, University, Certified XTC Partners ✭✭

    @MihaiCvasnievschi

    I am not sure if it is the same issue but I was getting a similar exception to what you noted: "Argument is out of a range.\n Parameter name: index" when I had bound a generic List to the ListView instead of an ObservableCollection. I would get the exception when I tried the new Pull-To-Refresh feature built into the ListView. I fixed it by using an ObservableCollection instead of a List.

    Dan

  • FokkeVermeulenOldFokkeVermeulenOld ✭✭ USMember ✭✭
    edited March 2015

    Does anyone have a sample for a listview with footer. I don't know how to set the footer

    I made a few test and in this way it doesn't work

    var listView = new ListView {
    Footer = new TextCell {
    Text = "Halt"
    },
    FooterTemplate = new DataTemplate(typeof(TextCell))
    };

  • RaphaelSchindlerRaphaelSchindler ✭✭✭ USMember ✭✭✭

    @TheRealJasonSmith
    I've already written in a thread for a new bug. Take a look at this: http://forums.xamarin.com/discussion/35906/tabbedpage-nullpointerexception
    I filled in a new bug here with an example app here: https://bugzilla.xamarin.com/show_bug.cgi?id=28191

  • WesselOosthuizenWesselOosthuizen ✭✭ USMember ✭✭

    @TheRealJasonSmith I am using the latest stable versions. I have a listview that opens another page whenever a list item is tapped. I am getting the error below. Sometimes it happens immediately on the first item tap, other times I would have to tap a few items before I get the error. It causes the app to crash.

        03-19 12:28:56.708 E/mono-rt (23728): [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: 'jobject' must not be IntPtr.Zero.
        03-19 12:28:56.708 E/mono-rt (23728): Parameter name: jobject
        03-19 12:28:56.708 E/mono-rt (23728):   at Android.Runtime.JNIEnv.CallIntMethod (IntPtr jobject, IntPtr jmethod) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/9e05e39f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:343 
        03-19 12:28:56.708 E/mono-rt (23728):   at Android.Widget.AdapterView.get_FirstVisiblePosition () [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/9e05e39f/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.AdapterView.cs:890 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFl03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.Platform.Android.ListViewAdapter.SelectItem (System.Object item) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.Platform.Android.ListViewAdapter.OnItemSelected (System.Object sender, Xamarin.Forms.SelectedItemChangedEventArgs eventArg) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at (wrapper delegate-invoke) System.EventHandler`1<Xamarin.Forms.SelectedItemChangedEventArgs>:invoke_void_object_TEventArgs (object,Xamarin.Forms.SelectedItemChangedEventArgs)
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindablePropertyContext context, System.Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.ListView.NotifyRowTapped (Int32 groupIndex, Int32 inGroupIndex) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.ListView.NotifyRowTapped (Int32 index) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.Platform.Android.ListViewAdapter.HandleItemClick (Android.Widget.AdapterView parent, Android.Views.View view, Int32 position, Int64 id) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Xamarin.Forms.Platform.Android.CellAdapter.OnItemClick (Android.Widget.AdapterView parent, Android.Views.View view, Int32 position, Int64 id) [0x00000] in <filename unknown>:0 
        03-19 12:28:56.708 E/mono-rt (23728):   at Android.Widget.AdapterView+IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ (IntPtr jnienv, IntPtr native__this, IntPtr native_parent, IntPtr native_view, Int32 position, Int64 id) [0x00019] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/9e05e39f/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.AdapterView.cs:194 
        03-19 12:28:56.708 E/mono-rt (23728):   at (wrapper dynamic-method) object:bc160864-7a13-4b98-9851-97d0881bda5a (intptr,intptr,intptr,intptr,int,long)
    
  • PaulPPaulP ✭✭ USMember ✭✭

    Upgrading to Xamarin Forms 1.4.0.6341 causes a Null Reference exception to be thrown in an Android Custom CellRenderer.

    Steps to reproduce

    1. Clone https://github.com/paulpatarinski/Xamarin.Forms.Plugins/tree/Forms_1.4.0.6341/ExtendedCells
    2. Run the Android project.

    as comparison if you checkout the master branch : https://github.com/paulpatarinski/Xamarin.Forms.Plugins/tree/master/ExtendedCells

    which is running Forms 1.3.2.6316 the exception does not occur.

    Stack Trace attached

  • BrunoVTBrunoVT ✭✭ BEUniversity ✭✭

    Hi,

    I love all the new features. They make my life a lot easier. But I still miss a lot of styling options for the most basic controls. With forms I cannot style my app completely like the way I would on a native platform. I now do this with renderers but it takes up a lot of my time I would like to spend on app features instead of styling.

  • XavyerXavyer ✭✭ MDMember ✭✭
    edited March 2015

    FooterTemplate cause NullReferenceException when StackLayout is put inside it. HeaderTemplate works fine in same conditions. I started a thread about this here

  • MikeEEEMikeEEE ✭✭✭ USMember ✭✭✭

    This is definitely a version 1.x product @BrunoVanThournout.9700 ... if you're in it now, you're in it for the long run. :) To me, it's like going through Silverlight all over again (but on a much bigger and viable scale). There was a lot of churn with Silverlight and it really didn't start getting awesome until 4.0. 5.0 was really quite supreme and you could make a living off it (if it wasn't for those darned devices and Apple...).

    I think Xamarin is more efficient than MSFT, however. :) In another year or so this tech is going to be UBER-supreme haha.

  • MihaiCvasnievschiMihaiCvasnievschi USUniversity
    edited March 2015

    @TheRealJasonSmith - found an interesting issue on iOS.

    Run the MobileCRM Sample on iOS while the Personal Hotspot has at least one connection (it would show under the iOS status bar).

    Forms do not properly resize the screen to show the Tab buttons (they got cut). This only happens when starting the app, if sent to background and reactivated the UI will be correctly displayed.

    Edit 1: I've tested on another app that we've developed and that uses Tabs and the issue can-not be reproduced. I think you could test this out whenever you have 5 minutes ;-) Not a show stopper!

  • voidvoid ✭✭✭ DKBeta ✭✭✭
    edited March 2015

    Footer is not shown on iOS.
    Footer height is not always calculated correctly on Android.

  • ApurvaGoyalApurvaGoyal ✭✭ USMember ✭✭

    @MihaiCvasnievschi were you able to get past through your linker error.I am getting same exception with 1.3.2 version of xamarin forms.

  • JoshGuibault.2609JoshGuibault.2609 USMember

    @TheRealJasonSmith I'm having the same issue @WesselOosthuizen reported earlier in the thread. I have a ListView that opens another page when clicked. This ListView occasionally (rarely, seemingly randomly) throws an error that crashes the app when clicked. This issue only happens on the Android build.

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
    at Android.Runtime.JNIEnv.GetMethodID (intptr,string,string) <0x000bf>
    at Android.Views.View.SetBackgroundResource (int) <0x0016b>
    at Xamarin.Forms.Platform.Android.CellAdapter.UnsetSelectedBackground (Android.Views.View) <0x00027>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.Select (int,Android.Views.View) <0x00033>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.SelectItem (object) <0x0009b>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.OnItemSelected (object,Xamarin.Forms.SelectedItemChangedEventArgs) <0x0003b>
    at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject,object,object) <0x000b3>
    at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,Xamarin.Forms.BindableObject/BindablePropertyContext,object,bool,Xamarin.Forms.BindableObject/SetValueFlags,bool) <0x002bf>
    at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,Xamarin.Forms.BindableObject/SetValueFlags,Xamarin.Forms.BindableObject/SetValuePrivateFlags) <0x0052f>
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object,bool,bool) <0x001bf>
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object) <0x00033>
    at Xamarin.Forms.ListView.set_SelectedItem (object) <0x00027>
    at Vintiri.ResultsPage/c__AnonStoreyC.<>m__2 (object,Xamarin.Forms.ItemTappedEventArgs) <0x0012b>
    at Xamarin.Forms.ListView.NotifyRowTapped (int,int) <0x00153>
    at Xamarin.Forms.ListView.NotifyRowTapped (int) <0x0006b>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.HandleItemClick (Android.Widget.AdapterView,Android.Views.View,int,long) <0x0007f>
    at Xamarin.Forms.Platform.Android.CellAdapter.OnItemClick (Android.Widget.AdapterView,Android.Views.View,int,long) <0x000eb>
    at Android.Widget.AdapterView/IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ (intptr,intptr,intptr,intptr,int,long) <0x000b7>
    at (wrapper dynamic-method) object.80fdc79f-27fb-4f57-b3ad-7a266273c360 (intptr,intptr,intptr,intptr,int,long) <0x0007b>

  • JoshGuibault.2609JoshGuibault.2609 USMember

    @TheRealJasonSmith I'm having the same issue @WesselOosthuizen reported earlier in the thread. I have a ListView that opens another page when clicked. This ListView occasionally (rarely, seemingly randomly) throws an error that crashes the app when clicked. This issue only happens on the Android build.

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
    at Android.Runtime.JNIEnv.GetMethodID (intptr,string,string) <0x000bf>
    at Android.Views.View.SetBackgroundResource (int) <0x0016b>
    at Xamarin.Forms.Platform.Android.CellAdapter.UnsetSelectedBackground (Android.Views.View) <0x00027>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.Select (int,Android.Views.View) <0x00033>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.SelectItem (object) <0x0009b>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.OnItemSelected (object,Xamarin.Forms.SelectedItemChangedEventArgs) <0x0003b>
    at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject,object,object) <0x000b3>
    at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,Xamarin.Forms.BindableObject/BindablePropertyContext,object,bool,Xamarin.Forms.BindableObject/SetValueFlags,bool) <0x002bf>
    at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,Xamarin.Forms.BindableObject/SetValueFlags,Xamarin.Forms.BindableObject/SetValuePrivateFlags) <0x0052f>
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object,bool,bool) <0x001bf>
    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object) <0x00033>
    at Xamarin.Forms.ListView.set_SelectedItem (object) <0x00027>
    at Vintiri.ResultsPage/c__AnonStoreyC.<>m__2 (object,Xamarin.Forms.ItemTappedEventArgs) <0x0012b>
    at Xamarin.Forms.ListView.NotifyRowTapped (int,int) <0x00153>
    at Xamarin.Forms.ListView.NotifyRowTapped (int) <0x0006b>
    at Xamarin.Forms.Platform.Android.ListViewAdapter.HandleItemClick (Android.Widget.AdapterView,Android.Views.View,int,long) <0x0007f>
    at Xamarin.Forms.Platform.Android.CellAdapter.OnItemClick (Android.Widget.AdapterView,Android.Views.View,int,long) <0x000eb>
    at Android.Widget.AdapterView/IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ (intptr,intptr,intptr,intptr,int,long) <0x000b7>
    at (wrapper dynamic-method) object.80fdc79f-27fb-4f57-b3ad-7a266273c360 (intptr,intptr,intptr,intptr,int,long) <0x0007b>

  • JamesLaveryJamesLavery ✭✭✭✭✭ GBBeta, University ✭✭✭✭✭

    I've just upgraded to this release to get the fix for bug 25611, but seem to have hit another one on WinPhone.

    If I have 52 items in a ListView, and I use the following code to scroll to the end:

    private void btnGotoEnd_Clicked(object sender, EventArgs e)
            {
                var model = this.BindingContext as ListViewPage2ViewModel;
                if (model != null)
                {
                    var scrollToItem = model.People[model.People.Count - 1];
                    lstPeople.ScrollTo(scrollToItem, ScrollToPosition.Start, false);
                }
    
            }
    

    This works fine on Android and iOS, but on WinPhone it only scrolls part way down the list- down to the 42nd item.

    I can't see this raised as a bug already.

  • wc.5543wc.5543 ✭✭ USUniversity ✭✭

    Did anyone encounter listview rendering issue where it sometimes doesn't display the content in cell and if the listview content is long enough for the cell that has display issue to scroll off screen and come back...the content will then display properly?

  • FredyWengerFredyWenger ✭✭✭✭✭ CHInsider ✭✭✭✭✭

    @monkichi:
    Yes I also had this (on iOS), but not really to comprehend.

  • MihaiCvasnievschiMihaiCvasnievschi USUniversity
    edited March 2015

    @TheRealJasonSmith I can confirm that ListView.ScrollTo works as long as the ListView is bind to an ObservableCollection but this degrades the performances of the initial load for long lists.

    Are there any plans to allow the ListView to ScrollTo Start or End without having to provide a specific item? It's not like I want to scroll to a particular item I just want to make sure that the list is at its start.

Sign In or Register to comment.