私はXamarin-formsを使ってアプリケーションを書いています。 popAsync()
を使用してリストを編集しているページから移動すると、前のページのリストを更新して変更を表示したいと考えています。Xamarin - PopAsync()後のリストを更新
私のPopulateMachineSelectionList()
は、私のmachine
オブジェクトをリストに追加します。
これは、あなたが(リストビューでの)ページAとページBを(つまり、リストビューにバインドさリストを編集)している場合、私はあなたがpageAViewModelを渡すことができると思い、私がこれまで試したものを
protected override void OnAppearing()
{
PopulateMachineSelectionList();
base.OnAppearing();
}
async void PopulateMachineSelectionList()
{
loadedMachines = await machineSync.GetMachines();
if (loadedMachines.Count() != 0)
{
machineSelectionList.Clear();
foreach (Machine mach in loadedMachines)
{ //I have an archive boolean that determines whether or not machines should be shown
if (!mach.archived)
{
Console.WriteLine("Adding: " + mach.name + " to the list template");
machineSelectionList.Add(new ListTemplate(null, mach.name, true, true));
}
}
Console.WriteLine("Refresh List");
machineList.ItemsSource = machineSelectionList;
}
machineList.SelectedItem = null;
}
machineList ObservableCollectionはありますか? –
私は手伝っていますが、あなたのシナリオに関する情報はほとんどありません。質問を編集してデータを追加してください。あなたが問題を抱えていること全般について私たちに文脈化してください。 –