图像控件:Image,如果在C#代码中动态更改Image的Source,那么会用到BitmapImage类,把BitmapImage赋值给Image.Source。
资源:是Silverlight中任何可重用的值。
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
这种设置属性的样式叫做绑定语法。
但是在项目中又找不到PhoneFontFamilyNormal这样的资源,这是因为在WP7设备本身已经有了嵌入的资源文件。
比如要设置一个button的边框为静态资源,只需要
<Button Content="OK" Margin="40" BorderBrush="{StaticResource PhoneAccentBrush}" />
在VS中自己创建样式,比如要为一个button设置前景色,点击button的property,找到Foreground,先设置好前景色,再如图
如果要自己创建样式,比如自己设置button的style,需要加入一下代码
<phone:PhoneApplicationPage.Resources>
</phone:PhoneApplicationPage.Resources> 在button中需要写入<Style x:Key="buttonStyle" TargetType="Button"> <Setter Property="BorderBrush" Value="Red" /> <Setter Property="Foreground" Value="Red" /> </Style>
Style="{StaticResource buttonStyle}"
如果想把Style设置成全局的,那么把
<Style x:Key="buttonStyle" TargetType="Button"> <Setter Property="BorderBrush" Value="Red" /> <Setter Property="Foreground" Value="Red" /> </Style>
加入到App.xaml的<Application.Resources> </Application.Resources>
标签中