title: How to get the index of an expanderview
body: <p>I created a dynamic list with a few expanderviews in them.</p>
  
  <p>Here is my code:</p>
  
  <pre><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);
  
          }
  </code></pre>
  
  <p>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.</p>
  
  <p>Here is a picture of the list after loading it to give a better idea.
  <img src="https://i.stack.imgur.com/3yV5H.png" alt="Expanderviews"></p>
  
  <p>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.</p>
  
  <p>This is all dynamic data, so the amount of items in list will change.</p>
  
  <p><strong>SOLVED</strong> :
  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</p>
  
  <p>1.</p>
  
  <pre><code> roleItem.Tag = 
                      TransactionType.ListOfRoles.IndexOf(role) + "," 
                      + WorkflowBase.ViewModel_WFTransaction.AvailableTransactionTypes.IndexOf(TransactionType) 
                      + "," + TransactionType.FormName 
                      + "," + TransactionType.ProcessID
                      + "," + TransactionType.ActivityID
                      + "," + TransactionType.FormID;
  </code></pre>
  
  <p>2.</p>
  
  <pre><code> this.NavigationService.Navigate(new Uri("/UI/Documents/frmGenericNewTransaction.xaml?Formname="
                                          + FormName.ToString() +
                                          "&amp;Role=" + roleindex +
                                          "&amp;Processindex="+ processindex +
                                          "&amp;Processid=" + ProcID +
                                          "&amp;Activityid=" + ActID +
                                          "&amp;Formid=" + FormID +
                                          "&amp;Roleid=" + RoleName, UriKind.Relative));  
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>NavigationContext.QueryString.TryGetValue("Activityid", out ActivityID);
  NavigationContext.QueryString.TryGetValue("Roleid", out RoleName);
  NavigationContext.QueryString.TryGetValue("Formid", out FormID);
  </code></pre>