MVVM CROSS中的选项卡控件 [英] Tab Control in MVVM CROSS
问题描述
我们正在开发一种支持WP,Android&使用Xamarin框架的iOS操作系统.
We are developing an application that supports WP, Android & iOS operating systems using Xamarin framework.
需要创建两个标签过滤器&使用过滤器选项卡进行搜索会从下拉列表,日期选择器中选择一些值,并加载搜索选项卡的列表网格.但是我找不到用于在MVVM CROSS(便携式库类)中创建选项卡控件的示例应用程序.
Need to create two tabs Filter & Search, using filter tab will select some values from drop down, date picker and load the listing grid of search tab. But I couldn't able to find a sample application for creating tab control in MVVM CROSS (Portable Library Class).
ViewModel类:
ViewModel Class:
public class SearchWOViewModel : MvxViewModel
{
public readonly ISearchWOService _serachwo;
public SearchWOViewModel()
{
Filter = new FilterViewModel(_serachwo);
Search = new SearchViewModel(_serachwo);
}
private FilterViewModel _Filter;
public FilterViewModel Filter { get { return _Filter; } set { _Filter = value; RaisePropertyChanged(() => Filter); } }
private SearchViewModel _Search;
public SearchViewModel Search { get { return _Search; } set { _Search = value; RaisePropertyChanged(() => Search); } }
}
public class FilterViewModel : MvxViewModel
{
public FilterViewModel(ISearchWOService search)
{
_filterwo = search;
SiteDropDown();
}
private string _SiteResult;
public List<DropDownEquipment> SiteResult
{ get { return _SiteResult; } set { _SiteResult = value; } }
public void SiteDropDown()
{
String query = "UserSite";
_filterwo.FillUserSite(query, result => SiteResult = result, error => { });
}
}
public class SearchViewModel : MvxViewModel
{
//How to call the service and load the listing grid while loading the page
private readonly ISearchWOService _serachwo;
public SearchViewModel(ISearchWOService search)
{
_serachwo = search;
SearchListingWO();
}
private List<ListingWo> _results;
public List<ListingWo> Results { get { return _results; } set { _results = value; RaisePropertyChanged(() => Results); } }
public void SearchListingWO() // Want to reload this function once site dropdown changes
{
String query = "x/x/INDIA/SA/WORKORDER";
_serachwo.Listingwo(query, result => Results = result,error => { });
}
}
推荐答案
看看Stuart Lodge的MVVMCross的N + 1天 在此处链接
Take a look at Stuart Lodge's N+1 days of MVVMCross Link Here
N = 25-制表符(MvvmCross的N + 1天)
N=25 - Tabs (N+1 Days of MvvmCross)
一些想法.使用消息(N = 9个视频)将选定的过滤器选项从过滤器选项卡"传递到搜索选项卡".当搜索选项卡"收到消息时,相应地更新(过滤)绑定集合.
edit: Some quick thought. Use message(N=9 video) to pass the selected filter option from 'Filter tab' to 'Search tab'. When 'Search tab' received the message, update(filter) the binding collection accordingly.
edit2:
我的问题是如何在MVXViewModel核心项目中触发选项卡更改事件"
iOS:SelectedViewController = ViewControllers [tabIndex];
Android:
edit2:
"My problem is how to fire the tab change event in MVXViewModel core project "
iOS: SelectedViewController = ViewControllers[tabIndex];
Android: how to change tab of a tabactivity from an activity started by the tabactivity ? or change current tab
Do all these in the VIEW code or bind the property to the viewmodel.
这篇关于MVVM CROSS中的选项卡控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!