Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

MvvmCross, cannot get built-in Visibility ValueConverter to work

$
0
0

I'm trying to apply the N+1 7 BooksPlus tutorial which shows how to use visibility to show/hide a progress bar in Android. I'm using the pre-built binaries, based on Stuart's instructions for working in Xamarin Studio.

(Xamarin Studio 4.0.12, Xcode 4.6.3, Xamarin.iOS 6.4.4.12, Xamarin.Android 4.8.1.)

I've added the required assemblies based on what I see in the .csproj files in the source from: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-07-BooksPlus

Snips from relative files below:

<ProgressBar
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/loadingProgressBar"
    local:MvxBind="Visibility IsLoading, Converter=Visibility"
    android:layout_marginBottom="10dp" />


    /// <summary>
    /// Should the loading progress be shown?
    /// </summary>
    /// <value><c>true</c> if shown; otherwise, <c>false</c>.</value>
    public bool IsLoading
    {
        get { return _isLoading;}
        set
        {
            _isLoading = value;
            RaisePropertyChanged(() => IsLoading);
        }
    }

And this is the error output I'm seeing:

mvx:Diagnostic: 3.82 Loading new ViewModel from Intent with Extras [0:] [MvxBind] 4.03 Problem seen during binding execution for to Visibility - problem ArgumentException: The value passed in must be an enum base or an underlying type for an enum, such as an Int32. [MvxBind] Parameter name: value [MvxBind] at (wrapper managed-to-native) System.Enum:ToObject (System.Type,object) [MvxBind] at Cirrious.MvvmCross.Binding.ExtensionMethods.MvxTypeExtensions.MakeSafeValue (System.Type propertyType, System.Object value) [0x0008c] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\ExtensionMethods\MvxTypeExtensions.cs:47 [MvxBind] at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.MakeSafeValue (System.Object value) [0x00000] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Target\MvxPropertyInfoTargetBinding.cs:144 [MvxBind] at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00056] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Target\MvxPropertyInfoTargetBinding.cs:82 [MvxBind] at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\MvxFullBinding.cs:144 MvxBind:Error: 4.03 Problem seen during binding execution for to Visibility - problem ArgumentException: The value passed in must be an enum base or an underlying type for an enum, such as an Int32. Parameter name: value at (wrapper managed-to-native) System.Enum:ToObject (System.Type,object) at Cirrious.MvvmCross.Binding.ExtensionMethods.MvxTypeExtensions.MakeSafeValue (System.Type propertyType, System.Object value) [0x0008c] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\ExtensionMethods\MvxTypeExtensions.cs:47 at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.MakeSafeValue (System.Object value) [0x00000] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Target\MvxPropertyInfoTargetBinding.cs:144 at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00056] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Target\MvxPropertyInfoTargetBinding.cs:82 [0:] MvxBind:Error: 4.03 Problem seen during binding execution for to Visibility - problem ArgumentException: The value passed in must be an enum base or an underlying type for an enum, such as an Int32. Parameter name: value at (wrapper managed-to-native) System.Enum:ToObject (System.Type,object) at Cirrious.MvvmCross.Binding.ExtensionMethods.MvxTypeExtensions.MakeSafeValue (System.Type propertyType, System.Object value) [0x0008c] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\ExtensionMethods\MvxTypeExtensions.cs:47 at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.MakeSafeValue (System.Object value) [0x00000] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Target\MvxPropertyInfoTargetBinding.cs:144 at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00056] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Target\MvxPropertyInfoTargetBinding.cs:82 at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\MvxFullBinding.cs:144

at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\MvxFullBinding.cs:144


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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