如何根据您在上一页上单击的内容,拥有不同的列表(包含1个列表)?

时间:2015-12-24 18:47:04

标签: c# forms list xamarin

所以我想要的是用户点击1,2或3并且你被推到同一页面,但我希望它是每个点击类别的唯一列表。因此,当您点击Clickthis1时,您将获得一个ListView,只有Clickthis1人可以访问,如果您点击Clickthis2,您将获得一个列表,只有您点击Clickthis2等等。

这是您单击所选类别的第一页的代码,具体取决于您点击的位置应该获得唯一的列表视图:

void Clickthis1 (object sender, EventArgs args)
{
var CategoryName = new StartPage();

CategoryName.TheCategoryName ("Info1", /* the list here?*/);

Navigation.PushAsync (CategoryName);
}


void Clickthis2 (object sender, EventArgs args)
{
var CategoryName = new StartPage();

CategoryName.TheCategoryName ("Info2", /* the list here?*/);


Navigation.PushAsync(CategoryName);
}

void Clickthis3 (object sender, EventArgs args)
{
var CategoryName = new StartPage();

CategoryName.TheCategoryName ("Info3", /* the list here?*/);


Navigation.PushAsync(CategoryName);
}

这是信息被推入的页面以及我有列表的位置。我不知道该如何从这里开始。

List<createSomething> ourPitems = new List<createSomething>();


public StartPage (){
InitializeComponent ();}

public class createSomething{
public string ourUsername {get; set;}
}


public void TheCategoryName (String pHeader, /*New list added here??? */)
{

personHeader.Text = pHeader;

}

protected override void OnAppearing(){
getItems (); }

async void getItems () 
{
var getItems = await parseAPI.myInfo (Application.Current.Properties 
["sessionToken"].ToString ());
EmployeeList.ItemsSource = null;



ourPitems = new List<createSomething> ();

foreach (var currentItem in getItems["results"]) 
{
ourPitems.Add (new createSomething ()


{

ourUsername = currentItem ["YourName"].ToString (),
});}

EmployeeList.ItemsSource = ourPitems;

}

0 个答案:

没有答案