Je travaille sur une application Android avec Xamarin et j'utilise MVVMCross pour cela. Maintenant, je veux utiliser le MvxAutoCompleteTextView mais je n'arrive pas à le faire fonctionner.Obtenir MvxAutoCompleteTextView au travail
J'ai fait un échantillon et ne peut pas l'obtenir correctement
suit Voici mon code: La vue autocomplete:
<Mvx.MvxAutoCompleteTextView
android:id="@+id/actSignal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:completionThreshold="1"
local:MvxItemTemplate="@layout/searchitemview"
local:MvxBind="ItemsSource Items; PartialText ItemSearchTerm; SelectedObject Item;" />
Le ItemView J'utilise:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
local:cardCornerRadius="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp">
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="20sp"
local:MvxBind="Text Name" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Le viewmodel:
public class FirstViewModel : MvxViewModel
{
private ObservableCollection<ItemClass> _items;
private ItemClass _item;
private string _searchTerm;
public ObservableCollection<ItemClass> Items
{
get => _items;
set => SetProperty(ref _items, value);
}
public ItemClass Item
{
get => _item;
set => SetProperty(ref _item, value);
}
public string ItemSearchTerm
{
get => _searchTerm;
set => SetProperty(ref _searchTerm, value);
}
public FirstViewModel()
{
Init();
}
private void Init()
{
Items = new ObservableCollection<ItemClass>
{
new ItemClass
{
Name = "Test1",
},
new ItemClass
{
Name = "Test2",
},
new ItemClass
{
Name = "Test3",
}
};
}
}
Quand je le lance et tapez quelque chose dans ce que je reçois le texte suivant dans la fenêtre de sortie
[0:] mvx:Diagnostic: 15.18 Wait starting for T
C'est le github où je mets mon échantillon: Github
Voici un exemple sur la façon d'utiliser [MvxAutoCompleteTextView] (https://github.com/JimWilcox3/MvxAutoCompleteTest). –
J'ai déjà vu cet exemple a cherché une erreur que j'ai faite mais je ne peux pas en trouver. – kevingoos
Modifier le code dans ce projet, quand je n'utilise pas 'MvxItemTemplate' pour' MvxAutoCompleteTextView' tout fonctionne bien, y a-t-il un problème? –