周末充电之WPF(二 ) .窗口的布局
登录窗口布局:[ Grid 布局 -Grid.RowDefinitions / Grid.ColumnDefinitions]
代码如下:
<Window x:Class="login.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="200" Width="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--默认在第0行0列-->
<!--HorizontalAlignment:水平方向对齐 VerticalAlignment:垂直方向对齐-->
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="username:"></TextBlock>
<TextBox Grid.Column="1" Name="uid" Margin="5"></TextBox>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="password:" Grid.Row="1"></TextBlock>
<PasswordBox Grid.Column="1" Name="pwd" Margin="5" Grid.Row="1"></PasswordBox>
<Button Content="login" Grid.Row="2" Margin="10" Click="Button_Click_1"></Button>
<Button Content="cancer" Grid.Row="2" Margin="10" Grid.Column="1"></Button>
</Grid>
</Window>
Menu / ToolBar 布局:
<Window x:Class="toolbar.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="打开">
<MenuItem Header="删除"></MenuItem>
</MenuItem>
<MenuItem Header="编辑"></MenuItem>
</Menu>
<ToolBar DockPanel.Dock="Top">
<Button>
<Button.Content>
<Image Source="s.png" Width="16"></Image>
</Button.Content>
</Button> <Button>
<Button.Content>
<Image Source="c.png" Width="16"></Image>
</Button.Content>
</Button>
<CheckBox>
<Image Source="cc.png" Width="16"></Image>
</CheckBox>
</ToolBar>
<TextBox DockPanel.Dock="Bottom"></TextBox>
</DockPanel>
</Grid>
</Window>
如上代码你会发现在为控件设置图标按钮时,会有两种写法 xx.Content 或者直接去除写 <Image...></Image> ,其实这两个是相同的。
周末充电之WPF(二 ) .窗口的布局的更多相关文章
- 周末充电之WPF(四).多窗口之间操作
多窗口实例: 1.在多个窗口的情况下如何自定义指定要启动的窗口程序 <Application x:Class="toolbar.App" xmlns="http:/ ...
- 周末充电之WPF(一).初试牛刀
追的剧已经赶上更新的速度了,突然觉得一下子就闲了.趁着这点时间,刚好学点 WPF .看到这边,好多人估计得感叹技术宅约等于单身狗,哈哈.好了,赶紧进入学习状态. 关注 WPF 或者说对它感兴趣其实多半 ...
- 周末充电之WPF(三 ) .后台动态生成控件
布局 -连连看: 代码: private void Window_Loaded_1(object sender, RoutedEventArgs e) { //动态创建行 ; i < ; i++ ...
- WPF自学入门(二)WPF-XAML布局控件
上一篇介绍了xaml基本知识,我们已经知道了WPF简单的语法.那么接下来,我们要认识一下WPF的布局容器.布局容器可以使控件按照分类显示,我们一起来看看WPF里面可以使用哪些布局容器用来布局. 在WP ...
- WPF自学入门(九)WPF自定义窗口基类
今天简单记录一个知识点:WPF自定义窗口基类,常用winform的人知道,winform的窗体继承是很好用的,写一个基础窗体,直接在后台代码改写继承窗体名.但如果是WPF要继承窗体,我个人感觉没有理解 ...
- WPF中的常用布局
一 写在开头1.1 写在开头评价一门技术的好坏得看具体的需求,没有哪门技术是面面俱到地好. 1.2 本文内容本文主要内容为WPF中的常用布局,大部分内容转载至https://blog.csdn.net ...
- [No000012A]WPF(2/7):布局,容器和布局转换[译]
概要 在上一篇文章中,我讨论了一些WPF应用的基础知识,它们是使用WPF的基本架构和内部结构.在本文中,我将讨论编写你的第一个WPF程序的基本的东西和怎么在你的窗口中布局控件.这是每一个想使用WPF的 ...
- Android 布局学习之——Layout(布局)详解二(常见布局和布局参数)
[Android布局学习系列] 1.Android 布局学习之——Layout(布局)详解一 2.Android 布局学习之——Layout(布局)详解二(常见布局和布局参数) 3.And ...
- WPF中的常用布局 栈的实现 一个关于素数的神奇性质 C# defualt关键字默认值用法 接口通俗理解 C# Json序列化和反序列化 ASP.NET CORE系列【五】webapi整理以及RESTful风格化
WPF中的常用布局 一 写在开头1.1 写在开头微软是一家伟大的公司.评价一门技术的好坏得看具体的需求,没有哪门技术是面面俱到地好,应该抛弃对微软和微软的技术的偏见. 1.2 本文内容本文主要内容 ...
随机推荐
- Error -26359: Function not allowed within a concurrent group
Error -26359: Function not allowed within a concurrent group 疑问: 基于url录制的脚步能用检查点么? 疑问: web_set_max ...
- java基础全套
这是我自己早前听课时整理的java基础全套知识 使用于初学者 也可以适用于中级的程序员 我做成了chm文档的类型 你们可以下载 笔记是比较系统全面,可以抵得上市场上90%的学习资料.讨厌那些随便 ...
- 【CSS】Intermediate7:Pseudo Elements
1.selector:pseudo element{property:value;} 2.first-letter first-line CSS3:: 与pseudo class 区别 old br ...
- maven,spring,mybatis集成错误
maven,spring,mybatis集成的时候单元测试junit测试没问题,但mvn jetty:run 就报错误 错误: org.apache.ibatis.binding.BindingExc ...
- fzu2109--Mountain Number(数位dp)
Problem Description One integer number x is called "Mountain Number" if: (1) x>0 and x ...
- SecureCRTPortable的安装和使用
玩玩这个远程连接软件,是个绿色软件. 别人已经做好了的. 解压之后, 下面,软件展示下, 这会默认去打开, 为了,方便,使用,放到桌面,作为快捷方式 成功
- leptonica 学习笔记1
Updated: April 26, 2015 Leptonica is a pedagogically-oriented open source site containing software t ...
- 问题-Delphi为什么不能连接oracle
问题现象:delphi 为什么不能连接oracle 问题处理:加一句OraSession1.Options.Net := True;
- C++下字符串转换
引用自:http://blog.sina.com.cn/s/blog_a98e39a20101ari9.html 把最近用到的各种unicode下类型转换总结了一下,今后遇到其他的再补充: 1.str ...
- python 一些重要的内建异常类