xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
xmlns:d='http://schemas.microsoft.com/expression/blend/2008'
xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'
mc:Ignorable='d'
d:DesignWidth='640'
d:DesignHeight='480'>
//File: Page.xaml.cs
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace SilverlightApplication3
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void RetrieveResourceNames_Click(object sender, RoutedEventArgs e)
{
Assembly app = Assembly.GetExecutingAssembly();
string[] resources = app.GetManifestResourceNames();
ResourceNames.Items.Clear();
foreach (string s in resources)
{
ResourceNames.Items.Add(s);
}
}
private void ResourceNames_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!(ResourceNames.SelectedItem.ToString().Contains("resources")))
{
Assembly app = Assembly.GetExecutingAssembly();
using (Stream stream = app.GetManifestResourceStream(ResourceNames.SelectedItem.ToString()))
{
BitmapImage bImage = new BitmapImage();
bImage.SetSource(stream);
ImageDisplay.Source = bImage;
ImageBorder.Visibility = Visibility.Visible;
}
}
}
}
}