title: Loop though Children elements , Find something and access its sibling property
body: <p>I have a <code>WrapPanel</code> which contains some Images (thumbnails).</p>
  
  <p>When the user press Left or Right arrow key, I want to show the next/previous image.</p>
  
  <pre><code>private void frmMain_KeyUp(object sender, KeyEventArgs e)
  {
      if (e.Key == Key.Right)
      {
          int j = 0;
          foreach (Image child in WrapPanelPictures.Children)
          {
              if (child.Source == MainPic.Source)
              {
                  MainPic.Source = WrapPanelPictures.Children[j + 1].Source;
              }
              j++;
          }
      }
  }
  </code></pre>
  
  <p>Also I tried a LINQ approach, but I'm a beginner with LINQ.</p>
  
  <pre><code>var imgfound = from r in WrapPanelPictures.Children.OfType&lt;Image&gt;()
                 where r.Source == MainPic.Source
                 select r;
  MessageBox.Show(imgfound.Source.ToString());
  </code></pre>
  
  <p>imgfound is supposed to be a list, right? maybe that's why I can't access Source property. Anyway this return the current Image shown. I want the sibling.</p>
  
  <p><strong>UPDATE</strong>:
  Well I made a workaround as for now. But still waiting for a proper solution.</p>
  
  <p>I created a ListBox and added all WrapPanel Childrens to it. Then used the <code>SelectedItem</code> and <code>SelectedIndex</code> properties to select the previous and next items.</p>