Windows Phone开发之图片控件Image及定义URI
图片控件Image的使用如下:[html]
<Image Grid.Column="1"
Grid.ColumnSpan="3"
Grid.Row="5"
Grid.RowSpan="2"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Name="image1"
Stretch="UniformToFill"
Source="/PhoneApp4;component/Images/Jellyfish.jpg"
Margin="8,0,72,0" />
解释:
Stretch="UniformToFill" 可以调整大小有拉伸效果
Stretch="Fill" 任意拉伸调整大小
Stretch="Uniform" 按照原图比例调整大小
Source="/PhoneApp4;component/Images/Jellyfish.jpg" 图片引用路径
后台代码修改图片:
System.Windows.Media.Imaging.BitmapImage myImage = new BitmapImage();
myImage.UriSource = new Uri("/PhoneApp4;component/Images/Tulips.jpg", UriKind.Relative);
image1.Source = myImage;
摘自 whuarui2010的专栏
补充:移动开发 , Windows Phone ,