I created a dynamic list with a few expanderviews in them.
Here is my code:
foreach (var TransactionType in WorkflowBase.ViewModel_WFTransaction.AvailableTransactionTypes)
{
ExpanderView newDoc = new ExpanderView();
newDoc.FontSize = 32;
newDoc.Margin = new Thickness() { Bottom = 10, Left = 13, Right = 10, Top = 15 };
newDoc.Header = TransactionType.ProcessName;
foreach (var role in TransactionType.ListOfRoles)
{
TextBlock roleItem = new TextBlock();
roleItem.FontSize = 28;
roleItem.Margin = new Thickness() { Bottom = 4, Left = 4, Right = 4, Top = 4 };
roleItem.Text = role;
roleItem.Tag = TransactionType;
roleItem.Tap += roleItem_Tap;
newDoc.Items.Add(roleItem);
}
NewTransactionsPanel.Children.Add(newDoc);
}
As you can see inside the expanderview I've put in textblocks to show my data, now what I want to do is when I click on one of those textblocks, I want to get the index of that item in list and also the index of the expanderview in the list. I have no idea how to go about doing this.
Here is a picture of the list after loading it to give a better idea.
For example, if I click on 'line manager' under the 'po Mobile' heading, I now want the index of the line manager textblock in that list of 2 items, and I want the index of the po mobile in the bigger list.
This is all dynamic data, so the amount of items in list will change.
SOLVED :
From the advice Kookiz gave me this is what i did,
1. i added all my data i needed in the textblock tag -see codesnippit below,
2.then i added it to my navigation ur,
3.and just queried it out on my other page load
1.
roleItem.Tag =
TransactionType.ListOfRoles.IndexOf(role) + ","
+ WorkflowBase.ViewModel_WFTransaction.AvailableTransactionTypes.IndexOf(TransactionType)
+ "," + TransactionType.FormName
+ "," + TransactionType.ProcessID
+ "," + TransactionType.ActivityID
+ "," + TransactionType.FormID;
2.
this.NavigationService.Navigate(new Uri("/UI/Documents/frmGenericNewTransaction.xaml?Formname="
+ FormName.ToString() +
"&Role=" + roleindex +
"&Processindex="+ processindex +
"&Processid=" + ProcID +
"&Activityid=" + ActID +
"&Formid=" + FormID +
"&Roleid=" + RoleName, UriKind.Relative));
3.
NavigationContext.QueryString.TryGetValue("Activityid", out ActivityID);
NavigationContext.QueryString.TryGetValue("Roleid", out RoleName);
NavigationContext.QueryString.TryGetValue("Formid", out FormID);