WPF布局容器综合展示
Border控件,以及几个重要要的属性:
Background:背景的 Brush 对象
BorderBrush:用来绘制边框
BorderThickness: Border 边框的宽度,设置边框每一边的线条的宽度
CornerRadius:Border 的每一个角圆的半径
Padding:内容与边框的之间的间隔
更多信息:http://msdn.microsoft.com/zh-cn/library/vstudio/system.windows.controls.border.aspx
<Border BorderBrush="#FFF1621E" BorderThickness="20,10" Margin="" CornerRadius="">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFECFFDF" Offset="0.75"/>
<GradientStop Color="#FFC0FF96" Offset=""/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Margin="6,7,8,7" TextWrapping="Wrap" Text=" Border 只能包含一个子元素,用于生成边框"/>
</Border>
Grid是一个重要的布局元素,也是最常用的一个布局元素
<Grid Grid.Column="" Margin="8,8,0,8">
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF95D241" Offset="0.806"/>
<GradientStop Color="#FFB9F764" Offset=""/>
</LinearGradientBrush>
</Grid.Background>
<TextBlock TextWrapping="Wrap" Height="38.08" VerticalAlignment="Top"><Run Text="Grid 采用非常灵活的行和列(构成 网格 )布局来排列子元素。"/></TextBlock>
<Rectangle
Fill="{DynamicResource StandardLinearGradientBrush}" Stroke="Black" Width="" HorizontalAlignment="Left" Margin="8,63.08,0,42"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Margin="31.192,0,0,18.92" Stroke="Black" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="" RadiusY="10.34" RadiusX="10.34"/>
<Rectangle Fill="{DynamicResource {x:Static SystemColors.InactiveCaptionBrushKey}}" Margin="70.192,0,79.952,42" Stroke="Black" RadiusY="8.42" RadiusX="8.42" Height="" VerticalAlignment="Bottom"/>
</Grid>
Canvas是一个画布容器,它本身不会调整内部元素的位置和大小.如果不指定内部元素的位置则默认显示在左上角
Canvas.Top 设置元素距Canvas顶部的距离,Canvas.Bottom 设置元素距Canvas底部的距离,Canvas.Left 设置元素距Canvas左边界的距离,Canvas.Right 设置元素距Canvas右边界的距离
更多信息:http://msdn.microsoft.com/zh-cn/library/vstudio/system.windows.controls.grid.aspx
<Canvas Background="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" Grid.Column="" Margin="" >
<TextBlock TextWrapping="Wrap" Text="Canvas 按照 X 和 Y 绝对坐标来排列子元素。 可用于固定元素在运行期间所在的屏幕位置,这与空白“画布” 类似。" Height="" Width=""/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Canvas.Left="" Stroke="Black" Canvas.Top="" Width="49.048"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Canvas.Left="34.048" Stroke="Black" Canvas.Top="" Width=""/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="36.08" Canvas.Left="62.048" Stroke="Black" Canvas.Top="112.92" Width=""/>
</Canvas>
stackpanel控件
<StackPanel Background="#FFCDE540" Margin="8,3.769,1.76,0" Grid.Row="" >
<TextBlock TextWrapping="Wrap" Text="StackPanel 将子元素沿水平或垂直方向排列(或 堆叠 )成一行。" Height=""/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Stroke="Black" Width="49.048" HorizontalAlignment="Left" Margin="8,0,0,0"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Stroke="Black" Width="" HorizontalAlignment="Left" Margin="34.048,0,0,0"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="29.08" Stroke="Black" Margin="71.048,0,69,0"/>
</StackPanel>
更多的信息可以以下了解:
http://msdn.microsoft.com/zh-cn/library/system.windows.controls.stackpanel.aspx
dockpanel控件展示
<DockPanel Background="#FF63A5EB" Grid.Column="" Margin="8,3.769,0,0" Grid.Row="" >
<TextBlock TextWrapping="Wrap" Text="DockPanel 将子元素沿水平或垂直方向排列(或 堆叠 )成一行。" Width="135.048"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Stroke="Black" Width="49.048" Margin="0,0,0,10" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Stroke="Black" Width="" Margin="0,0,0,10" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="42.08" Stroke="Black" Width="" Margin="0,0,0,10" VerticalAlignment="Bottom" DockPanel.Dock="Bottom"/>
</DockPanel>
更多的信息可以以下了解:
http://msdn.microsoft.com/zh-cn/library/vstudio/system.windows.controls.dockpanel.aspx
ScrollViewer控件
<ScrollViewer Background="#FF99D1AC" Grid.Column="" Margin="8,0,8,3.769" Grid.Row="" >
<Grid>
<TextBlock TextWrapping="Wrap" Text="ScrollViewer 一个允许您滚动其中所含的子元素的元素。该元素仅包含单个子元素。" Height="" VerticalAlignment="Top"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Stroke="Black" Width="49.048" HorizontalAlignment="Left" Margin="8,0,0,40.931" VerticalAlignment="Bottom"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="" Stroke="Black" Width="" HorizontalAlignment="Left" Margin="34.048,0,0,19.931" VerticalAlignment="Bottom"/>
<Rectangle Fill="{DynamicResource StandardLinearGradientBrush}" Height="28.931" Stroke="Black" Margin="51.048,0,71.096,8" VerticalAlignment="Bottom"/>
</Grid>
</ScrollViewer>
效果展示:

展示当前的集中控件,更多详细信息http://msdn.microsoft.com/zh-cn/library/vstudio/system.windows.controls.aspx
当前demo下载:http://files.cnblogs.com/BABLOVE/WPF%E5%B8%83%E5%B1%80%E5%AE%B9%E5%99%A8%E7%BB%BC%E5%90%88%E6%BC%94%E7%A4%BA.rar
WPF布局容器综合展示的更多相关文章
- WPF 布局之综合实例
WPF 布局之综合实例 <Window x:Class="UniFormGridDemo.MainWindow" xmlns="http://schemas.mic ...
- WPF 10天修炼 第四天- WPF布局容器
WPF布局 WPF的窗口也就是Window类,是一个内容控件,该控件派生自ContentControl.内容控件有一个Content属性,该属性有一个限制,只能放置一个用户界面元素,或一个字符串.为了 ...
- WPF布局容器
1.StackPanel:堆栈面板,通过Orientation属性设置子元素的布局排列方向为“Vertical”(垂直)和“Horizontal”(水平),不写其默认值为“Vertical”,当设置为 ...
- 学习WPF——WPF布局——了解布局容器
WPF布局工作内部原理 WPF渲染布局时主要执行了两个工作:测量和排列 测量阶段,容器遍历所有子元素,并询问子元素所期望的尺寸 排列阶段,容器在合适的位置放置子元素,并设置元素的最终尺寸 这是一个递归 ...
- 浅谈 WPF布局
我们首先来了解一下图形化用户界面(Graphic User Interface)也就是我们常常听到的GUI.举个简单的例子,同样是数据,我们可以用控制台程序加格式控制符等输出,但是这些都不如GUI来的 ...
- WPF布局介绍(1)
开局一张图,内容全靠...,本系列的文章, 主要针对刚入门.亦或是从 winform/bs转过来的开发人员快速入门的指南, 相对于其它一些文章中会详细的从项目如何建立到其实现的原理及组成部分, 本系列 ...
- 【WPF学习】第十章 WPF布局示例
前几章用了相当大的篇幅研究有关WPF布局容器的复杂内容.在掌握了这些基础知识后,就可以研究几个完整的布局示例.通过研究完整的布局示例,可更好的理解各种WPF布局概念在实际窗口中的工作方式. 一.列设置 ...
- 学习WPF——WPF布局——初识布局容器
StackPanel堆叠布局 StackPanel是简单布局方式之一,可以很方便的进行纵向布局和横向布局 StackPanel默认是纵向布局的 <Window x:Class="Wpf ...
- WPF快速入门系列(1)——WPF布局概览
一.引言 关于WPF早在一年前就已经看过<深入浅出WPF>这本书,当时看完之后由于没有做笔记,以至于我现在又重新捡起来并记录下学习的过程,本系列将是一个WPF快速入门系列,主要介绍WPF中 ...
随机推荐
- ASP.NET- LinkButton 传递多个参数
在使用LinkButton时可能会遇到需要传递多个参数的问题,而LinkButton的用来传递参数的属性commandargument需要传递的是一个string类型的值.因而传递多个参数时需要进行一 ...
- ctrl+z的JAVA实现,借助了命令模式(command pattern)
前些天学习<<JAVA与模式>>,到命令模式时,随带给了一个CTRL+Z案例的实现,想来学习编程这么久,CTRL+Z还没有认真实现过. 因此,借助JAVA与模式里面的源代码,自 ...
- pcap的pcap_dump()保存的文件格式
(2009-09-01 20:36:49) 转载▼ 标签: 杂谈 分类: 专业 首先是tcpdump文件格式 当你在Windows或者Linux环境下用tcpdump命令抓取数据包时,你将得到如下格式 ...
- 3 Ways of JDK Source Code Attachment in Eclipse---reference
You wanna look at a JVM class while you are coding and you cannot. Here is the solution. First of al ...
- 15分钟弄懂 const 和 #define
什么是const ? 什么是#define? 他们有什么用? 他们有什么区别? 应该怎么用? 总结 1. 什么是const ? const是C/C++中的一个关键字(修饰符), const一般用来定义 ...
- Android开发之TextView的下划线添加
如何给TextView添加下划线呢,最近项目中需要这个,于是就用代码添加了下划线功能.主要就是用Paint的setFlags方法来实现,具体如下: ((TextView)mScrollView.fin ...
- runtime重写description方法打印model属性和值
在开发过程中, 往往会有很多的model来装载属性. 而在开发期间经常会进行调试查看model里的属性值是否正确. 那么问题来了, 在objective-c里使用NSLog("%@" ...
- 自己做的demo---宣告可以在java世界开始自由了
package $interface; public interface ILeaveHome { public abstract int a(); public abstract int b(); ...
- C#语法糖之第六篇: 泛型委托- Predicate<T>、Func<T>
今天继续分享泛型委托的Predicate<T>,上篇文章讲了Action委托,这个比Action委托功不一样的地方就是委托引用方法是Bool返回值的方法,Action为无返回值.首先我们看 ...
- [FTP] FTPHelper-FTP帮助类,常用操作方法 (转载)
点击下载 FTPHelper.zip 这个类是FTP服务器的一些操作1.连接FTP服务器 2.上传3.下载4.删除文件5.获取当前目录下明细(包含文件和文件夹) 6.获取FTP文件列表(包括文件夹) ...