1)
// image создаю программно, но можно и из x:Name использовать аналогично (без var image = new System.Windows.Controls.Image();)
var image = new System.Windows.Controls.Image();
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(path, UriKind.Absolute);
bitmap.EndInit();
Image.Source = bitmap;
2)
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class Bitmap : Image
3)
тык
4)
<Image Width="90" Height="90"
Source="{Binding Path=ImageSource}"
Margin="0,0,0,5" />
public object ImageSource {
get {
BitmapImage image = new BitmapImage();
try {
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
image.UriSource = new Uri( FullPath, UriKind.Absolute );
image.EndInit();
}
catch{
return DependencyProperty.UnsetValue;
}
return image;
}
}
5)
<Image>
<Image.Source>
<BitmapImage UriSource="{Binding Path=ImagePath, Converter=...}" />
</Image.Source>
</Image>
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(value as string);
image.EndInit();
return image;
6)
img.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("/www/image.png");