- Grid - 基本上是一種表格,用以將物件放置在資料列和資料行中。
- StackPanel - 用以將物件放置在另一個物件的旁邊,或是放在另一個物件的上方。
- Canvas - 用於絕對位置 (而且從 Silverlight 1.0 開始就未變更)
<Grid.RowDefinitions>
<RowDefinition Height="450"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Grid.Column="0" Grid.Row="0">
<TextBox x:Name="mytextbox" FontSize="20" Text="Hello World" Height="120"
Width="200" Canvas.Left="50" Canvas.Top="10"></TextBox>
<Button Click="Button_Click" Content="按我!" Height="120" Width="200"
FontSize="26" Canvas.Left="50" Canvas.Top="150"></Button>
<ToggleButton x:Name="bt1" Content="QQ" Height="120" Width="200" Canvas.Left="50"
Canvas.Top="300" Click="bt1_Click" IsThreeState="True"></ToggleButton>
<ScrollViewer Background="Blue" Height="120" Width="300"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible"
Canvas.Left="280" Canvas.Top="10">
<TextBlock TextWrapping="Wrap" Text="1234567890 嘿嘿!! 測試!!"
FontSize="20" FontWeight="light" HorizontalAlignment="Right" IsHitTestVisible="True"
LineStackingStrategy="MaxHeight"></TextBlock>
</ScrollViewer>
<Rectangle Fill="AliceBlue" Height="60" Width="60" Canvas.Left="280"
Canvas.Top="150"></Rectangle>
<Rectangle Fill="BurlyWood" Height="60" Width="60" Canvas.Left="360"
Canvas.Top="200"></Rectangle>
</Canvas>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0">
<TextBlock Text="UserName:" VerticalAlignment="Center" Foreground="White"></TextBlock>
<TextBox Width="200" Height="30" HorizontalAlignment="Left"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<TextBlock Text="Password:" VerticalAlignment="Center" Foreground="White"></TextBlock>
<TextBox Width="200" Height="30" HorizontalAlignment="Left"></TextBox>
</StackPanel>
<Canvas Grid.Column="1" Grid.Row="0">
<Button x:Name="bt2" Click="bt2_Click" Content="全螢幕" Height="30" Width="150" Canvas.Left="50" Canvas.Top="10"></Button>
</Canvas>
</Grid>
沒有留言:
張貼留言