How to bind ItemClick in MvxListView in MvxListView
Date : March 29 2020, 07:55 AM
it fixes the issue The DataContext for your person list item is a Person - so your SelectDogCommand needs to be part of the Person class - e.g. something like: public class Person
{
private string _name;
private List<Dog> _hasDogs;
public List<Dog> HasDogs
{
get { return _hasDogs; }
set { _hasDogs = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
private Cirrious.MvvmCross.ViewModels.MvxCommand<Dog> _selectDog;
public System.Windows.Input.ICommand SelectDogCommand
{
get
{
_selectDog = _selectDog ?? new Cirrious.MvvmCross.ViewModels.MvxCommand<Dog>(dog => _parent.SelectDog(dog));
return _selectDog;
}
}
private FirstViewModel _parent;
public Person(FirstViewModel parent)
{
_parent = parent;
}
}
|
Reusing items in MvxListView
Date : March 29 2020, 07:55 AM
Any of those help When reusing a list item, the binding will set the DataContext again, and this will cause the bindings to be reevaluated.
|
MvxListView with MvxSpinner showing null entry on the first Item
Tag : chash , By : Thomas Plunkett
Date : March 29 2020, 07:55 AM
To fix the issue you can do After much help from @Cheesebaron and @Stuart I have found that if you use MvxSpinner or MvxAutoComplete in an ItemTemplate inside an MvxItemList, then anything in the hierarchy above and including the MvxItemlist cannot have android:layout_height="wrap_content". The reason is that the Android OS has to draw things more than once if it has to determine their height dynamically. All the redraws get things confused in the binding. If you set everything to a fixed height, everything works fine. To fix the above problem, the Markup for the MvxItemView above should be <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<MvxListView
android:layout_width="fill_parent"
android:layout_height="300dp"
local:MvxBind="ItemsSource ShipmentLots.Lots"
local:MvxItemTemplate="@layout/inventorylotview" />
<ImageButton
android:src="@drawable/ic_action_new"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
local:MvxBind="Click NewLot_Clicked"
android:id="@+id/btnLotNew" />
</LinearLayout>
|
MvvmCross: Populating MvxListView with items displays line between rows by default
Date : March 29 2020, 07:55 AM
it should still fix some issue Try the following: 1) If you want to remove divider line use this code : android:divider="@null"
android:divider="@android:color/transparent"
android:dividerHeight="5dp"
|
MvvmCross MvxListView Items Not Rendering on Android
Date : March 29 2020, 07:55 AM
this one helps. The property to load a collection is ItemsSource, not ItemSource. Replace this: local:MvxBind="ItemSource Reminders"
local:MvxBind="ItemsSource Reminders"
|