Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
one)
// 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;
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class Bitmap : Image
<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;
}
}
<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;
img.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("/www/image.png");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question