Welcome

首页 / 软件开发 / Silverlight / 一起学Windows Phone7开发(十三.四 基本控件)

一起学Windows Phone7开发(十三.四 基本控件)2010-11-07 博客园 小镇在这里,把一些最基本的控件列出来,其实也就是没有归类的控件都放在这里了。

一.TextBlock:这个控件其实就是Label控件。

<TextBlock x:Name="PageTitle" Text="page name" Margin="-3,-8,0,0" Style="{StaticResource PhoneTextTitle1Style}" TextWrapping="Wrap"/>Style:设置字体、字色、大小等样式,用StaticResource方式可以绑定预设的样式。

TextWrapping:设置是否自动换行。

Text:在控件上要显示的文字。

二.CheckBox:多选控件,通过blend工具也可以生成多种效果,另外要想将选择框加大,并不是能过设置Width,Height来完成的,而是通过RenderTransform的Scale来完成的。

<CheckBox Content="CheckBox1" Height="80" HorizontalAlignment="Left" Margin="102,113,0,0" Name="checkBox1" VerticalAlignment="Top" Width="279" BorderBrush="Red" Foreground="Blue" Checked="checkBox1_Checked" Background="Yellow"/>

<CheckBox Content="CheckBox2" Height="72" HorizontalAlignment="Left" Margin="148,0,0,346" Name="checkBox2" VerticalAlignment="Bottom" Checked="checkBox2_Checked" RenderTransformOrigin="0.5,0.5" BorderBrush="#BFFB2200" Foreground="#FF1008F7">

<CheckBox.Background>

<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">

<GradientStop Color="White" Offset="0.504"/>

<GradientStop Color="#FFF7E306" Offset="1"/>

<GradientStop Color="#FFF7E306" Offset="0.004"/>

</LinearGradientBrush>

</CheckBox.Background>

<CheckBox.RenderTransform>

<CompositeTransform ScaleX="2" ScaleY="2"/>

</CheckBox.RenderTransform>

</CheckBox>