3
votes

I want to bind a TouchUpInside event to a custom control on Xamarin iOS with MugenMvvm.

bindingSet.Bind(moreThanFourHoursButton).To(() => (vm, ctx) => vm.TimeButtonClickedCommand)

I tried the above code but I get following Exception:

Error: The binding member cannot be obtained from the path 'DefaultBindingMember' on the 'Mobile.EDevice.iOS.Views.Custom.TimeButton'. at MugenMvvmToolkit.Binding.Infrastructure.BindingMemberProvider.GetBindingMember (System.Type sourceType, System.String path, System.Boolean ignoreAttachedMembers, System.Boolean throwOnError) [0x0010a] in <89993fb2052d4882bce9f7d6fb2304e4>:0 at MugenMvvmToolkit.Binding.BindingExtensions.TryGetBindingMemberValue[TSource,TValue] (TSource source, MugenMvvmToolkit.Binding.Models.BindingMemberDescriptor2[TSource,TValue] member, System.Object[] args, System.Boolean throwOnError, TValue& value) [0x0003f] in <89993fb2052d4882bce9f7d6fb2304e4>:0 at MugenMvvmToolkit.Binding.BindingExtensions.GetBindingMemberValue[TSource,TValue] (TSource source, MugenMvvmToolkit.Binding.Models.BindingMemberDescriptor2[TSource,TValue] member, System.Object[] args) [0x00000] in <89993fb2052d4882bce9f7d6fb2304e4>:0 at MugenMvvmToolkit.Binding.BindingExtensions.GetBindingMemberValue[TSource,TValue] (TSource source, MugenMvvmToolkit.Binding.Models.BindingMemberDescriptor2[TSource,TValue] member) [0x00007] in <89993fb2052d4882bce9f7d6fb2304e4>:0 at MugenMvvmToolkit.Binding.BindingBuilderExtensions.Bind[TTarget,TSource] (MugenMvvmToolkit.Binding.Interfaces.IBindingBuilder builder, TTarget targetGeneric) [0x00000] in <89993fb2052d4882bce9f7d6fb2304e4>:0 at MugenMvvmToolkit.Binding.Builders.BindingSet1[TSource].Bind[TLocalTarget] (TLocalTarget target) [0x00006] in <89993fb2052d4882bce9f7d6fb2304e4>:0 at Mobile.EDevice.iOS.Views.Controllers.ActivityTracking.ActivityDurationViewController.ViewDidLoad () [0x00a1b] in /Users/Admin/Documents/CimziaCompanionApp-Mobile/src/iOS/Views/Controllers/ActivityTracking/ActivityDurationViewController.cs:154 at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool_IntPtr (intptr,intptr,intptr,bool,intptr) at UIKit.UIViewController.PresentViewController (UIKit.UIViewController viewControllerToPresent, System.Boolean animated, System.Action completionHandler) [0x0006e] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:789 at MugenMvvmToolkit.iOS.Infrastructure.Mediators.ModalViewMediator.ShowView (MugenMvvmToolkit.iOS.Interfaces.Views.IModalView view, System.Boolean isDialog, MugenMvvmToolkit.Interfaces.Models.IDataContext context) [0x0005f] in <5ec134adfe6542a4bd7f31656741c9a6>:0 at MugenMvvmToolkit.Infrastructure.Mediators.WindowViewMediatorBase1+<>c[TView].<ShowInternal>b__55_2 (MugenMvvmToolkit.Infrastructure.Mediators.WindowViewMediatorBase1[TView] base, System.Boolean b, MugenMvvmToolkit.Interfaces.Models.IDataContext arg3) [0x00007]

1

1 Answers

3
votes

Ok, so I figured it out, this is how I bind my Command to a custom EventHandler:

bindingSet.Bind(moreThanFourHoursButton, nameof(moreThanFourHoursButton.Click)).To(() => (vm, ctx) => vm.TimeButtonClickedCommand)