惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Palo Alto Networks Blog
Martin Fowler
Martin Fowler
T
Threatpost
D
Docker
S
Schneier on Security
M
MIT News - Artificial intelligence
G
Google Developers Blog
L
LINUX DO - 热门话题
J
Java Code Geeks
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
博客园 - Franky
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
人人都是产品经理
人人都是产品经理
Spread Privacy
Spread Privacy
T
Tailwind CSS Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
C
CERT Recently Published Vulnerability Notes
The GitHub Blog
The GitHub Blog
Simon Willison's Weblog
Simon Willison's Weblog
NISL@THU
NISL@THU
MongoDB | Blog
MongoDB | Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Heimdal Security Blog
Recorded Future
Recorded Future
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
P
Privacy International News Feed
P
Proofpoint News Feed
O
OpenAI News
B
Blog
腾讯CDC
F
Full Disclosure
Apple Machine Learning Research
Apple Machine Learning Research
T
Tor Project blog
H
Hacker News: Front Page
Project Zero
Project Zero
Hugging Face - Blog
Hugging Face - Blog
C
Cisco Blogs
S
Security Affairs

博客园 - 牛奶哥

C#点滴 - 深拷贝与浅拷贝 C#点滴 - 抽象类与接口区别 C#点滴 - ?与?? C#点滴 - 值类型与引用类型 C#点滴 - 类型转换 C#点滴 - 关于String C#点滴 – 内建基本类型 C#点滴 – CLR, CTS…等等基本概念 SharePoint 2010 学习资料 初学SilverLight - (2)第一个SilverLight程序 初学SilverLight - (1)开发环境准备 WCF热带鱼书学习手记 - Security (1) 概述 关于在SharePoint中管理大文件的一些想法 WCF热带鱼书学习手记 - Service Contract Overload WCF热带鱼书学习手记 - client coding WCF热带鱼书学习手记 - metadata WCF热带鱼书学习手记 - endpoint - 牛奶哥 WCF热带鱼书学习手记 - ABC WCF热带鱼书学习手记 - Host Type - 牛奶哥
初学SilverLight - (3)简单布局
牛奶哥 · 2009-12-25 · via 博客园 - 牛奶哥

在VS里面我没有找到xaml的design模式,不知道是少安装了什么东西。不过还好我安装了Blend express,这个工具主要用做开发silverlight的界面,是一个标准的design工具。下面看看怎么用。

1. 打开vs的solution explorer,右键一个xaml文件,可以看到

2. 看到Open in Expression Blend了吧,别想了,直接点吧

这个界面以后还要慢慢熟悉,不过基本上MS提供的东西用户体验还是非常好的,这个blend就属于那种直接就能上手的工具啦。好了,废话不多说,这篇要讲layout,也就是布局。布局在设计页面的时候是非常重要的,它是实现程序细节的前提条件。Silverlight提供了一些基本的布局控件供开发使用。看上图左上角,Assers->Controls->Panels,这里列出了silverlight布局控件

1. Canvas - 通过坐标,用绝对位置来定位controls

<Canvas> 
<Button Canvas.Top="50" Canvas.Left="50" Content="Button 1" FontSize="18" Width="150" Height="45" />
<Button Canvas.Top="150" Canvas.Left="20" Content="Button 2" FontSize="18" Width="150" Height="45" />
<Button Canvas.Top="70" Canvas.Left="80" Canvas.ZIndex="99" Content="Button 3" FontSize="18" Width="150" Height="45" />
</Canvas>

2. Grid - 类似于表格,把control放在一个个分开的小格子中

<Grid ShowGridLines="True">
    <Grid.RowDefinitions>
        <RowDefinition Height="60" />
        <RowDefinition Height="60" />
        <RowDefinition Height="60" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="175" />
        <ColumnDefinition Width="175" />
        <ColumnDefinition Width="175" />
    </Grid.ColumnDefinitions>
    <Button Grid.Column="0" Grid.Row="0" Content="Button 1" FontSize="18" Width="150" Height="45" />
    <Button Grid.Column="2" Grid.Row="0" Margin="10" Content="Button 2" FontSize="18" Width="150" Height="45" />  
    <Button Grid.Column="1" Grid.Row="2" Margin="10" Content="Button 3" FontSize="18" Width="150" Height="45" /> 
</Grid>

3. StackPanel - 控件按照横向或者纵向依次排列

<StackPanel>   
<Button Margin="10" Content="Button 1" FontSize="18" Width="150" Height="45" />   
<Button Margin="10" Content="Button 2" FontSize="18" Width="150" Height="45" />   
<Button Margin="10" Content="Button 3" FontSize="18" Width="150" Height="45" />  
</StackPanel>

4. TabPanel - control被分散放在不同的tab中。

            	<System_Windows_Controls_Primitives:TabPanel Height="363" Width="407">
            		<controls:TabItem Header="TabItem1">
            			<Grid/>
            		</controls:TabItem>
            		<controls:TabItem Header="TabItem2">
            			<Grid/>
            		</controls:TabItem>
            		<controls:TabItem Header="TabItem3">
            			<Grid/>
            		</controls:TabItem>
            	</System_Windows_Controls_Primitives:TabPanel>

5. VirtualizingStackPanel - 从名字上看就是虚拟的StackPanel。它的意义在于,如果silverlight容器内包含大量控件,虽然不在一个页中显示出来,但是实际也是生成了,这样可能会造成性能上的损失。用虚拟化的方法假设当前没有显示出来的控件是存在的,然后计算layout,只有当前可见控件才会创建,仅当实际需要的时候显示的时候才会显示那些不可见控件。。。现在可能能用到的场景不是很多吧。

OK,这篇就写这么多啦。