我有一個Mvvmcross/Xamarin應用程序在droid部分的問題。 我已經做了「MvxSpinner菜單」至極的情侶名單上綁定 ViewModel.csXamarin.Android/MvvmCross:使用MvxSpinner導航
private List<CoupleIntString> _actions = new List<CoupleIntString>() {
new CoupleIntString(0,"Actions"),
new CoupleIntString(1, "Mail"),
new CoupleIntString(2,"Imprimer"),
new CoupleIntString(3, "Totaux"),
new CoupleIntString(4, "Fiche client")
};
public List<CoupleIntString> Actions {
get { return _actions; }
set {
_actions = value;
RaisePropertyChanged(() => Actions);
}
}
droid.axml
<MvxSpinner
android:id="@+id/action_spinner"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
local:MvxItemTemplate="@layout/item_spinner"
local:MvxDropDownItemTemplate="@layout/item_spinnerdropdown"
local:MvxBind="ItemsSource Actions;SelectedItem ActionSelected" />
當我選擇一個項目,我設置的SelectedAction我FirstViewModel並顯示我想要加載的視圖模型。但是,當我回到FirstViewModel時,它會自動重新設置SelectedAction並返回到第二個ViewModel。回到頂端這篇文章中的信息適用於: 我嘗試在Init,ReloadState,Start,InitFromBundle和ReloadFromBundle中將我的SelectedAction設置爲none,但在所有這些調用之後,還有另一個具有我之前選擇的值,我不知道它來自哪裏。
感謝您的幫助,但這不起作用。而且,我們正試圖在機器人部分儘可能減少代碼。 –