`
deepfuture
  • 浏览: 4334936 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:79435
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:68412
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:101532
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:281270
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:14619
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:65612
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:31336
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45222
社区版块
存档分类
最新评论

silverlight 5开发【vb版】(4)-容器

 
阅读更多

容器里可以放很多控件,我们可以看XAML。

<UserControl x:Class="SilverlightApplication2.MainPage"
    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"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <sdk:Label Height="40" HorizontalAlignment="Left" Margin="88,210,0,0" Name="Label1" VerticalAlignment="Top" Width="207" />
        <sdk:Label Height="32" HorizontalAlignment="Left" Margin="82,247,0,0" Name="Label2" VerticalAlignment="Top" Width="214" />
        <StackPanel Height="66" HorizontalAlignment="Left" Margin="68,68,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="272">
            <TextBox Height="25" Name="TextBox1" Width="206" DataContext="{Binding}" Text="" />
            <Button Content="确定" Height="22" Name="Button1" Width="183" />
        </StackPanel>
    </Grid>

  StackPanel就是一个容器

        <StackPanel Height="66" HorizontalAlignment="Left" Margin="68,68,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="272">
            <TextBox Height="25" Name="TextBox1" Width="206" DataContext="{Binding}" Text="" />
            <Button Content="确定" Height="22" Name="Button1" Width="183" />
        </StackPanel>
从上面可以看出来有2个控件在容器里,TextBox和Button

 

因为一个控件里可以包括多个属性,比如:

            <Button  Height="22" Name="Button1" Width="183">
                <Button.Content>
                    确定
           </Button.Content>
            </Button>

但一个控件需要包括多个控件,必须是容器。

 

<UserControl x:Class="SilverlightApplication2.MainPage"
    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"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <sdk:Label Height="40" HorizontalAlignment="Left" Margin="68,153,0,0" Name="Label1" VerticalAlignment="Top" Width="207" />
        <sdk:Label Height="32" HorizontalAlignment="Left" Margin="68,209,0,0" Name="Label2" VerticalAlignment="Top" Width="214" />
        <StackPanel Height="66" HorizontalAlignment="Left" Margin="68,68,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="272">
            <TextBox Height="25" Name="TextBox1" Width="206" DataContext="{Binding}" Text="" />
            <Button  Height="22" Name="Button1" Width="183">
                <Button.Content>
                    确定
           </Button.Content>
            </Button> 

        </StackPanel>
    </Grid>
</UserControl>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics