silverlight imagesource賦值與轉換

介紹幾種經常使用的Image source 賦值方式:this

this.abc.Source = new BitmapImage(new Uri("/1.jpg", UriKind.RelativeOrAbsolute));
Uri uri = new Uri("1.jpg", UriKind.Relative);
ImageSource imgSource = new System.Windows.Media.Imaging.BitmapImage(uri);   
this.abc.SetValue(Image.SourceProperty, imgSource);
this.abc.Source = new BitmapImage(new Uri("F:\\1.jpg", UriKind.RelativeOrAbsolute));

/{程序集名};component搜索/{圖片資源路徑}spa

 var uri = new Uri("/AppleMenu;component/Res/" + value + ".png", UriKind.Relative);
                IconImage.Source = new System.Windows.Media.Imaging.BitmapImage(uri);
相關文章
相關標籤/搜索