C# 什么模式适合组合数据源、Prism 6和Xamarin.Forms.Behavior?

C# 什么模式适合组合数据源、Prism 6和Xamarin.Forms.Behavior?,c#,xamarin.forms,prism,viewmodel,syncfusion,C#,Xamarin.forms,Prism,Viewmodel,Syncfusion,在我的应用程序v1中,我使用异步REST服务加载Xamarin表单中ListView的内容,并使用Prism绑定视图和ViewModel 我想用Xamarin.Forms行为中实现的一些特性来增强GUI,这是我第一次尝试合并到我的Prism应用程序中 我当前的代码(v1)如下所示:(注意REST调用 public MyPeopleListViewModel(INavigationService navigationService, IEventAggregator ea) : base(

在我的应用程序v1中,我使用异步REST服务加载Xamarin表单中ListView的内容,并使用Prism绑定视图和ViewModel

我想用Xamarin.Forms行为中实现的一些特性来增强GUI,这是我第一次尝试合并到我的Prism应用程序中

我当前的代码(v1)如下所示:(注意REST调用

    public MyPeopleListViewModel(INavigationService navigationService, IEventAggregator ea) : base(navigationService, ea)
    {
        Title = "Contacts";

        tapCommand = new Command<Syncfusion.ListView.XForms.ItemTappedEventArgs>(OnTapped);
        loadedCommand = new Command<SfListView>(OnListViewLoaded);
        swipeImageCommand = new Command<Models.TrustedContactItem>(OnSwipeImageTapped);
        swipeCommand = new Command<SwipingEventArgs>(OnSwipeCommand);

        MyContactsList = new ObservableCollection<Models.TrustedContactItem>();

        // THIS PART IS RELEVANT TO THE STACKOVERFLOW QUESTION
        LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync());

        _navigationService = navigationService;
    }
公共MyPeopleListViewModel(INavigationService navigationService,IEventAggregator ea):基础(navigationService,ea) { Title=“联系人”; TAPCOMAND=新命令(OnTapped); loadedCommand=新命令(OnListViewLoaded); swipeImageCommand=新命令(OnSwipeImageTapped); swipeCommand=新命令(OnSwipeCommand); MyContactsList=新的ObservableCollection(); //这一部分与STACKOVERFLOW问题有关 LoadItemsCommand=new命令(async()=>await executeloadItemsCommand()); _导航服务=导航服务; } …其中最重要的部分在上面注释

我的问题是我如何正确地引用一个行为

该行为是否会自动使将视图和ViewModels连接在一起的Prism自动绑定功能不相关


如何在使用Prism时实现加载此视图的行为?

我们想让您知道,在使用Prism时,不必为ViewModel类创建新实例,因为它将与App.Xaml.cs中的主页一起注册。因此,在behavior类中,您可以从SfListVie获取ViewModel实例在ItemTapped事件中展开或折叠项[Accordion-like view]时,w的BindingContext

有关更多详细信息,您可以参考以下UG文档

为了您的帮助,我们附上了修改后的样本,您可以从下面的链接下载

示例链接:

您可以从指定的URL获取和加载SFListView中的项目。由于我们没有任何特定的REST服务可用,我们建议您按照以下链接给出的过程来实现您的要求

您可以通过从联机服务器获取数据将更多项目加载到集合中。您可以参考下面的文档链接,了解在SfListView中按需加载更多项目的过程

如果您需要更多详细信息,请告知我们

问候,

G.Muthu kumaran.

谢谢@kyuubi-你能告诉我更多关于如何识别选择了哪个扩展项(例如阻止、呼叫等)并执行导航等操作的信息吗?