【飞秋】一起学Windows Phone7开发(十三.四 基本控件)
在這里,把一些最基本的控件列出來,其實也就是沒有歸類的控件都放在這里了。
一.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>
?
?
?
三.RadioButton:單選按鈕。當有多個在一起時,可以自動互斥。與多選控件一樣,要想使控件變大,需要使用Transform scale來實現。
<RadioButton Content="RadioButton1" Grid.Row="1" Height="72" HorizontalAlignment="Left" Margin="84,79,0,0" Name="radioButton1" VerticalAlignment="Top" Width="294" />
<RadioButton Content="RadioButton2" Grid.Row="1" Height="72" HorizontalAlignment="Left" Margin="84,183,0,0" Name="radioButton2" VerticalAlignment="Top" />
<RadioButton Content="RadioButton3" Grid.Row="1" Height="72" HorizontalAlignment="Left" Margin="84,299,0,0" Name="radioButton3" VerticalAlignment="Top" />
?
四.ProgressBar:? 進度條控件。有兩種形式,一種是顯示確切進度的;另一種是不確定的,不斷重復。
<ProgressBar Grid.Row="1" Height="71" HorizontalAlignment="Left" Margin="24,109,0,0" Name="progressBar1" VerticalAlignment="Top" Width="424"? Value="80"/>
?<ProgressBar Grid.Row="1" Height="55" HorizontalAlignment="Left" Margin="36,273,0,0" Name="progressBar2" VerticalAlignment="Top" Width="412"? IsIndeterminate="True"/>IsIndeterminate:設置進度條形式,False:不重復的進度,按value值變化進度;True:重復進度條。
?
?
五.Slider:滑桿控件??梢栽O置水平、垂直方向。
<Slider Grid.Row="1" Height="90" HorizontalAlignment="Left" Margin="20,30,0,0" Name="slider1" VerticalAlignment="Top" Width="460" />
<Slider Grid.Row="1" Height="390" HorizontalAlignment="Left" Margin="192,166,0,0" Name="slider2" VerticalAlignment="Top" Width="59"? Orientation="Vertical" />
?Orientation:設置滑桿方向。
IsDirectionReversed:設置Slider控件值的增加方向。
Value:設置當前值。
?
?
?六.PopUp: 彈出控件,可以顯示到當前頁的最前面。這個控件可以用來做自定義的messagebox,等待框等。
<Popup Grid.Row="1" HorizontalAlignment="Left" Margin="109,172,0,0" Name="popup1" VerticalAlignment="Top" Height="250" Width="250" IsOpen="True" Opened="popup1_Opened">
<Canvas Width="250" Height="250"? Background="Red" VerticalAlignment="Center" HorizontalAlignment="Center">
?<TextBlock Margin="90,120,0,0" Text="請等待......">
?</Canvas>
??? </Popup>
?
?
?七.Thumb:這個控件可以通過拖動,獲取連續的坐標(有點兒像筆記本上的觸摸板),從而和其他控件組合使用來產生控件拖動效果。
<Thumb Grid.Row="1" Height="125" HorizontalAlignment="Left" Margin="154,99,0,0" Name="thumb1" VerticalAlignment="Top" Width="190"? DragDelta="thumb1_DragDelta" DragCompleted="thumb1_DragCompleted" DragStarted="thumb1_DragStarted"/>
?
八.MultiScaleImage:這個控件主要用來實現DeepZoom功能,可以很方便的縮放你的圖片,這些圖片可以在Silverlight提供的巨大的虛擬空間上繪制出來。常用在地圖的顯示上,以及多圖片的預覽。這個在DeepZoom中已詳細介紹過。
?
關注技術文章飛秋:http://www.freeeim.com/,24小時專業轉載。
?
總結
以上是生活随笔為你收集整理的【飞秋】一起学Windows Phone7开发(十三.四 基本控件)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如果把西游记倒过来看,这才是真正的社会
- 下一篇: 各个数据库的取一表前N条记录不同SQL写