Mvvmcross switch binding does not work on release

I have a strange error in my MVVMCross application.

Given the following scenario:

<Switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:clickable="false" android:layout_alignParentRight="true" android:id="@+id/activatedSwitch" local:MvxBind="Checked IsActive" /> 
  • Compilation Version: Level 14
  • Minimum Version: Level 14
  • Target Version: Level 14

  • Binding: Sdk Builds Only

  • Android phone version 4.1.2.

When I launch the application in Debug mode, everything is fine.

But when I ran it in Release , the link to the Checked property ended with the following error:

E / MvxBind (11670): 12.70 View type not found - Switch

+7
binding xamarin mvvmcross
source share
1 answer

Since MvvmCross uses reflection to perform data binding, the linker does not see the Checked property and does not include it in its binary. There is a file name LinkerPleaseInclude.cs that you can edit to add a link to this property.

Something like:

 public void Include(Switch @switch) { @switch.CheckedChange += (sender, args) => @switch.Checked = !@switch.Checked ; } 
+12
source share

All Articles