我的應用程序是在MVVM架構中。如何從xamarin的另一頁更新一頁的ObservableCollection <>
我有photo.xaml頁面,其中我有一個1 ListView whoose bindingcontext是ObservableCollection在其viewmodel.cs文件中定義的照片listphoto。
現在我必須重定向到BarcodeScan.cs從按鈕點擊photo.xaml。
我的問題我如何添加項目listphoto從這裏(BarcodeScan.cs)?
我試圖在BarcodeScan這樣定義
public ObservableCollection<JobPhoto> ListSerialNumbers { get; set; }
新的列表,並在其構造intialised這樣
ListSerialNumbers = new ObservableCollection<JobPhoto>();
但photo.xaml頁上不更新列表。
我該如何做到這一點。我是MVVM的新手。請幫助。
謝謝。
非常感謝你:) –