title: Display image using xml
body: <p>I am trying to make simple task that display all image using xml. But i can't that task completely. Please help me...<br/><br/>
  <strong>My xaml code:</strong></p>
  
  <pre><code>&lt;ScrollViewer&gt;
              &lt;ListBox x:Name="imglist" Loaded="imglist_Loaded"&gt;
                  &lt;ListBox.ItemsPanel&gt;
                      &lt;ItemsPanelTemplate&gt;
                          &lt;toolkit:WrapPanel /&gt;
                      &lt;/ItemsPanelTemplate&gt;
                  &lt;/ListBox.ItemsPanel&gt;
                  &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
  
                          &lt;Image x:Name="img" Source="{Binding ImageUrl}" Width="160" Height="160"/&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.ItemTemplate&gt;
              &lt;/ListBox&gt;
          &lt;/ScrollViewer&gt;
  </code></pre>
  
  <p>My xml file:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8" ?&gt;&lt;Image ImageUrl = "C:/Users/USER 1/Documents/Visual Studio 2012/Projects/pinchimage/pinchimage/Butterfly.jpg"/&gt;
  
    &lt;Image   ImageUrl="C:/Users/USER 1/Documents/Visual Studio 2012/Projects/pinchimage/pinchimage/Desert.jpg"/&gt;
  
    &lt;Image    ImageUrl="C:/Users/USER 1/Documents/Visual Studio 2012/Projects/pinchimage/pinchimage/Field.jpg"/&gt;
  &lt;images&gt;
  
    &lt;Image ImageUrl = "C:/Users/USER 1/Documents/Visual Studio 2012/Projects/pinchimage/pinchimage/Butterfly.jpg"/&gt;
  
    &lt;Image   ImageUrl="C:/Users/USER 1/Documents/Visual Studio 2012/Projects/pinchimage/pinchimage/Desert.jpg"/&gt;
  &lt;/images&gt;
  </code></pre>
  
  <p><strong>Manipage.xaml.cs</strong>:</p>
  
  <pre><code>private void imglist_Loaded(object sender, RoutedEventArgs e)
          {
              var element = XElement.Load("Authors.xml");
              var authors = from var in element.Descendants("Image")
                            select new images
                            {
                                ImageUrl = GetImage(var.Attribute("ImageUrl").Value)
                            };
              imglist.ItemsSource = authors;
          }
  
          private ImageSource GetImage(string p)
          {
              return new BitmapImage(new Uri(p, UriKind.Relative));
          }
  </code></pre>
  
  <p><strong>class file:</strong></p>
  
  <pre><code>public class images
  {
      public ImageSource ImageUrl { get; set; }
  }
  </code></pre>