传统布局(canvas, grid, stackpanel)

http://www.cnblogs.com/Terrylee/archive/2008/03/07/Silverlight2-step-by-step-part3.html

 

silverlight3新增的布局

http://space.itpub.net/12639172/viewspace-590777

UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="Silverlight1.ColorChange"
    d:DesignWidth="640" d:DesignHeight="480">
 
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300"></ColumnDefinition>
            <ColumnDefinition Width="200"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        
        <StackPanel Margin="20" Grid.Column="0">
            <TextBlock Text="red"></TextBlock><Slider Name="sliRed" Maximum="255" Value="255"></Slider>
            <TextBlock Text="blue"></TextBlock><Slider Name="sliblue" Maximum="255" Value="255"></Slider>
            <TextBlock Text="green"></TextBlock><Slider Name="sligreen" Maximum="255" Value="255"></Slider>
            <TextBlock Text="alpha"></TextBlock><Slider Name="slialpha" Maximum="255" Value="255"></Slider>
        </StackPanel>
        <StackPanel Grid.Column="1">
            <Rectangle x:Name="rect_Color" Height="80" Fill="Blue" Margin="20">
            </Rectangle>
            <TextBlock FontSize="12"><Run Text="Color"/></TextBlock>
            <TextBox x:Name="HexColor" Width="160" Height="30" Text="#FF6600" Margin="10,5" FontSize="11"/>
        </StackPanel>
    </Grid>
</UserControl>
<!--
margin属性 左上右下
Name相当于asp.net的ID
 -->

相关文章:

  • 2021-05-19
  • 2021-11-08
  • 2021-12-29
  • 2022-02-10
  • 2021-11-09
  • 2021-07-03
  • 2021-07-26
猜你喜欢
  • 2021-11-29
  • 2021-08-01
  • 2021-07-07
  • 2021-10-06
  • 2021-07-19
  • 2021-11-24
  • 2022-12-23
相关资源
相似解决方案