robinmanuelthiel / flexbutton

Flexible button control for Xamarin.Forms
MIT License
240 stars 34 forks source link

TouchedDownCommand NullReferenceException #69

Closed ghost closed 5 years ago

ghost commented 5 years ago

Describe the bug When pushing a page that contains a FlexButton with TouchedDownCommand set to a working command, it just throws an exception. I tested the exactly same command with others controls, also with ClickedCommand, for any reason TouchedUp doesn't fire

Another weird behavior is that when TouchedDown or TouchedUp is set, the Highlights doesn't fire at all

This is my Xaml code:

<flex:FlexButton HorizontalOptions="Center" IconOrientation="Left" WidthRequest="60" HeightRequest="60" Padding="15" CornerRadius="30" HasShadow="True" Icon="plus_green.png" ForegroundColor="White" BackgroundColor="#6279B8" BorderColor="#6279B8" HighlightBackgroundColor="#8EA4D2" HighlightBorderColor="#8EA4D2" TouchedDownCommand="{Binding NavigateCommand}" TouchedDownCommandParameter="{x:Type views:LogActivityPage}"/>

Stacktrace at Flex.Controls.FlexButton.OnPropertyChanging (System.String propertyName) [0x00050] in <4e7ea7817b6a40aeaf988e69731f2581>:0 at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00065] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:590 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417 at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00225] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:173 at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 at Xamarin.Forms.Binding.Apply (System.Object context, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:130 at Xamarin.Forms.BindableObject.ApplyBindings (System.Boolean skipBindingContext, System.Boolean fromBindingContextChanged) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:448 at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x0005a] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:135 at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:504 at Xamarin.Forms.Element.b__78_0 (Xamarin.Forms.BindableObject child, System.Object bc) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:324 at Xamarin.Forms.BindableObjectExtensions.PropagateBindingContext[T] (Xamarin.Forms.BindableObject self, System.Collections.Generic.IList1[T] children, System.Action2[T1,T2] setChildBindingContext) [0x0002c] in D:\a\1\s\Xamarin.Forms.Core\BindableObjectExtensions.cs:27 at Xamarin.Forms.Element.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:322 at Xamarin.Forms.View.OnBindingContextChanged () [0x0000c] in D:\a\1\s\Xamarin.Forms.Core\View.cs:158 at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x00062] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:136 at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:504 at Xamarin.Forms.TemplatedPage.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\TemplatedPage.cs:35 at Xamarin.Forms.Element.b__78_0 (Xamarin.Forms.BindableObject child, System.Object bc) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:324 at Xamarin.Forms.BindableObjectExtensions.PropagateBindingContext[T] (Xamarin.Forms.BindableObject self, System.Collections.Generic.IList1[T] children, System.Action2[T1,T2] setChildBindingContext) [0x0002c] in D:\a\1\s\Xamarin.Forms.Core\BindableObjectExtensions.cs:27 at Xamarin.Forms.Element.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:322 at Xamarin.Forms.Page.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:214 at Xamarin.Forms.ContentPage.OnBindingContextChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\ContentPage.cs:16 at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:468 at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:625 at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:573 at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99 at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25 at Mobile.Views.DashboardPage..ctor () [0x00010] in C:\Users\Jose Luis Belisario\source\repos\leafytracker\Mobile\Mobile\Views\DashboardPage.xaml.cs:16

Please complete the following information:

Jamesmallon1 commented 5 years ago

Currently experiencing same crash as above!

Current hack is to put a 2 second delay and display a loading HUD while navigating. However this is terrible.

Jamesmallon1 commented 5 years ago

@robinmanuelthiel I have created a pull request to resolve this issue:

REF: #70