chore: add avalonia ListBox demo.

This commit is contained in:
NaBian committed 2025-02-08 17:37:58 +08:00
1 parent 98b67b3fd5
commit 29cf68d8ec
7 files changed
+157 -58

No files matched your search

@@ -76,11 +76,20 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
//load items
DemoInfoCollection = [];
foreach (var item in _dataService.GetDemoInfo())
Dispatcher.UIThread.InvokeAsync(() =>
{
Dispatcher.UIThread.InvokeAsync(() => DemoInfoCollection.Add(item));
}
Dispatcher.UIThread.InvokeAsync(() => SwitchDemo(DemoInfoCollection.First().DemoItemList.First()));
DataList = _dataService.GetDemoDataList();
foreach (var item in _dataService.GetDemoInfo())
{
DemoInfoCollection.Add(item);
}
if (DemoInfoCollection.Any() && DemoInfoCollection.First().DemoItemList.Any())
{
SwitchDemo(DemoInfoCollection.First().DemoItemList.First());
}
});
}
private void SwitchDemo(DemoItemModel item)