1
public class Thumbnail : INotifyPropertyChanged
{
public BitmapImage testimage { get; set; }
Thumbnail()
{
testimage = new BitmapImage(new Uri("http://www.diseno-art.com/news_content/wp-content/uploads/2012/09/2013-Jaguar-F-Type-1.jpg"));
}
}
而且在自定義控制圖像元素:結合的BitmapImage
<Image x:Name="previewImage" x:FieldModifier="public" Margin="8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Source="{Binding Path=thumbnail.testimage}" Stretch="Fill" />
當我創建一個控制,我這樣做:
MyControl MC = new MyControl();
MC.DataContext = new Thumbnail();
和圖像不顯示 - 爲什麼?