Using the code such as found below, sometimes certain .PNG files will fail to load. While other images, nearly identical in size, never have any such problem. Build Action set to Resource.
Why is that? Anybody figure it out? This is for a datagrid but I doubt the control has much to do with it. Probably certain .png files make Visual Studio 2008 choke because of some attribute set internally.
But it's a mystery to me....anybody else notice this?
private void dGrid_LoadingRow(object sender, DataGridRowEventArgs e)
Employee emp = e.Row.DataContext as Employee;
FrameworkElement ele = dGrid.Columns.GetCellContent(e.Row);
string url = "http://localhost:7642/DisplayImageHandler.ashx?id=" + emp.ID;
Uri imageUri = new Uri(url, UriKind.RelativeOrAbsolute);
(ele as Image).Source = new BitmapImage(imageUri);
private void img1_ImageFailed(object sender, ExceptionRoutedEventArgs e)
Image img = sender as Image;
// Display an image for error here
View Complete Post