当前位置:网站首页>WPF 界面布局必知基础
WPF 界面布局必知基础
2022-07-29 06:20:00 【济南医疗小程序状元】
WPF 界面布局必知基础
<Window x:Class="WpfApp1728.MainWindow"
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"
xmlns:local="clr-namespace:WpfApp1728"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<!--<DockPanel>
<Button Content="top Button" DockPanel.Dock="Top" Height="135" Width="370" ></Button>
</DockPanel>-->
<Grid ShowGridLines="True">
<Grid.RowDefinitions>
<!--行定义 3行4列的定义 -->
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--列定义-->
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="Left Top Button" />
<!--1 指定行 Grid.Row="2" 2 指定列 Grid.Column="3" 控制按钮的位置。把附加属性用好,就基本够用了。-->
<Button Content="Right Bottom Top Button" Grid.Row="2" Grid.Column="3" />
</Grid>
</Window>
<Window x:Class="WpfApp1728.MainWindow"
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"
xmlns:local="clr-namespace:WpfApp1728"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<!--<DockPanel>
<Button Content="top Button" DockPanel.Dock="Top" Height="135" Width="370" ></Button>
</DockPanel>-->
<Grid ShowGridLines="True">
<Grid.RowDefinitions>
<!--行定义 3行4列的定义 -->
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--列定义-->
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="Left Top Button" />
<!--1 指定行 Grid.Row="2" 2 指定列 Grid.Column="3" 控制按钮的位置。把附加属性用好,就基本够用了。-->
<Button Content="Right Bottom Top Button" Grid.Row="2" Grid.Column="3" />
<!--跨列设计属性 Grid.ColumnSpan-->
<Button Content="ColumnSpan Button" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" />
<!--跨行属性 Grid.RowSpan-->
<Button Content="RowSpan Button" Grid.Row="0" Grid.Column="1" Grid.RowSpan="3"/>
</Grid>
</Window>
效果
最小宽度设置,最小压缩设置也叫做。
<Button Content="Left Top Button" MinWidth="80" />
最小宽度
<!--列定义-->
<ColumnDefinition MinWidth="100" Width="*"/>
效果
自适应(到跟文字内容同样的高度) auto代码以及效果
<!--行定义 3行4列的定义 -->
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
内外边距
<Button Content="Right Bottom Top Button" Grid.Row="2" Margin="10,10,10,10" Grid.Column="3" />
外边距效果
边栏推荐
- pytest合集(7)— 参数化
- 【C语言刷LeetCode】1054. 距离相等的条形码(M)
- Teacher Wu Enda machine learning course notes 01 introduction
- 上采样之反卷积操作
- 'function VTable for error: undefined reference to... 'cause and solution of the problem
- MVFuseNet:Improving End-to-End Object Detection and Motion Forecasting through Multi-View Fusion of
- Basic knowledge of MySQL (high frequency interview questions)
- SSH password free login - two virtual machines establish password free channel two-way trust
- VMware16创建虚拟机:Win11无法安装
- 网上传说软件测试培训真的那么黑心吗?都是骗局?
猜你喜欢
Teacher wangshuyao's notes on operations research course 10 linear programming and simplex method (discussion on detection number and degradation)
LDAP brief description and unified authentication description
竣达技术 | 适用于”日月元”品牌UPS微信云监控卡
Jetpack Compose 中的键盘处理
剑指 Offer II 115:重建序列
要不要满足客户所有的需求
实战!聊聊如何解决MySQL深分页问题
MVFuseNet:Improving End-to-End Object Detection and Motion Forecasting through Multi-View Fusion of
外包干了3年,跳槽后转自动化测试工资是原来的2倍,秘诀原来是......
【flask入门系列】Flask-SQLAlchemy的安装与配置
随机推荐
建木持续集成平台v2.5.2发布
【解决方案】ERROR: lib/bridge_generated.dart:837:9: Error: The parameter ‘ptr‘ of the method ‘FlutterRustB
MutationObserver文档学习
The core of openresty and cosocket
Relative date used by filter in salesforce
基于C语言实现图书借阅管理系统
线程 - 线程安全 - 线程优化
Leetcode-592: fraction addition and subtraction
【Redis】Redis开发规范与注意事项
mysql可以定时导出表格吗?
Teacher Cui Xueting's course notes on optimization theory and methods 00 are written in the front
Cesium反射
游戏资产的革命
Teacher Wu Enda machine learning course notes 01 introduction
微信小程序的反编译
太空射击第17课: Game Over (結束)
MySQL queries are case sensitive
Flink实时仓库-DWD层(交易域-加购维度退化处理)模板代码
SS command details
Talk about tcp/ip protocol? And the role of each layer?