我们正在开发一个使用 Xamarin 框架支持 WP、Android 和 iOS 操作系统的应用程序。
需要创建两个选项卡过滤器和搜索,使用过滤器选项卡将从下拉列表中选择一些值,日期选择器并加载搜索选项卡的列表网格。但是我找不到在 MVVM CROSS(便携式库类)中创建选项卡控件的示例应用程序。
视图模型类:
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 => { });
}
}