I have an MvxSpinner associated with a List<PhotoCategory> , thus:
<Mvx.MvxSpinner style="@style/Spinners" android:id="@+id/photoCategorySpinner" android:prompt="@string/photoCategory_prompt" local:MvxBind="ItemsSource PhotoCategories; SelectedItem SelectedPhotoCategory; Visibility ShowPhotoFields, Converter=Visibility" local:MvxDropDownItemTemplate="@layout/spinner_photocategories" local:MvxItemTemplate="@layout/item_photocategory" />
SelectedPhotoCategory to which the SelectedItem parameter is PhotoCategory is also PhotoCategory . When this screen is in βupdate modeβ, the ViewModel sets the SelectedPhotoCategory to PhotoCategory, where PhotoCategoryId matches the one in the SQLite database. However, when the counter is displayed, the default value is displayed (which I add to the PhotoCategories property, PhotoCategory = 0, CategoryName = "[Select Category]"). The only fix I found is the code (which works fine) is added to the view:
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.PhotoView);
I also tried using the GetPosition method for MvxSpinner.Adapter, but this always returns -1 for PhotoCategoryId, CategoryName or SelectedPhotoCategory as the parameter value.
What am I missing?
source share