namespace helloxml
code behind it
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
}
private void listBox1_Loaded(object sender, RoutedEventArgs e)
{
var element = XElement.Load("Authors.xml");
var authors = from var in element.Descendants("Author")
orderby var.Attribute("AuthorName").Value
select new Authors
{
AuthorId = Convert.ToInt32(var.Attribute("AuthorId").Value),
AuthorName = var.Attribute("AuthorName").Value,
AuthorImage = GetImage(var.Attribute("AuthorImage").Value),
Description = var.Attribute("Description").Value,
Source = var.Attribute("Source").Value
};
listBoxAuthors.DataContext = authors;
}
public ImageSource GetImage(string path)
{
return new BitmapImage(new Uri(path, UriKind.RelativeOrAbsolute));
}
private void listBoxAuthors_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var listBoxItem = listBoxAuthors.SelectedItem as ListBoxItem;
TextBlock nameBlock = listBoxItem.FindName("srctxtbox") as TextBlock;
MessageBox.Show(nameBlock.Text);
}
}

Replies
Know the answer? Post it — somebody with the same question will find it here.