解开XAML的邪恶面纱
什么是XAML,首先我们看下它的外观
<Window x:Class="Blend_WPF.WindowStyle"
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:Blend_WPF" mc:Ignorable="d" >
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="271,203.5,0,0" VerticalAlignment="Top" Width="75"/>
</Grid>
</Window>
外一层是Window,进一层是Grid,再进一层是Button,感觉是和Web静态网页一样的写法,除了前面多了一些自己暂时还看不懂的xmlns
其实并不是,XAML官方定义是:一种相对简单、通用的声明式编程语言。所以别看这标签是这样,其实一个个对象(经过XAML编译器和运行时解析器解释后)
比如上面的一个Button
<Button Content="Button" />
解开面纱,看本质
Button b=new Button();
b.Content="Button";
WPF通过XAML语言实现界面与逻辑分离,在一定程度上方便了开发人员和设计人员的分工协作,取得了不错的效果
最新文章
- Linux内核笔记--内存管理之用户态进程内存分配
- 全栈工程师学习Linux技术的忠告
- Android 测试工具
- c++ boost 汉字和模式串混用的例子
- Redis 五:配置主从复制功能
- Django Navi 重用
- Bind Enum to ListControl
- Adatper中获取宽高为0的问题
- java组装json和提取一个json的例子
- Roslyn and NRefactory
- 使用nio对磁盘下的文件进行过滤
- 反射实现java深度克隆
- CentOS6.5 上crontab每天自动备份mysql数据库
- ssh 登录报错 packet_write_wait: Connection to x.x.x.x port 22: Broken pipe
- Linux中dpkg工具update-alternatives实现符号链接软件版本的切换(转)
- Fiddler基础用法-抓取浏览器数据包
- 最近开始研究php的缓存技术,来个系统自带的OPcache
- mybatis递归,一对多代码示例
- Xcode代码提示里的字母含义
- pytharm提示过期 License Activation 解决办法
热门文章
- allure用法(一)-配置信息及基本用法
- 2021年3月-第02阶段-前端基础-HTML+CSS阶段-Day03
- [译]ng指令中的compile与link函数解析 转
- Java数组-2022年4月17日
- XCTF练习题---MISC---Training-Stegano-1
- 一篇讲清楚String、StringBuffer和StringBuild
- 解决:Could not resolve dependencies for project xxx: Could not find artifact xxx
- learnByWork
- 国产开源优秀新一代MPP数据库StarRocks入门之旅-数仓新利器(上)
- 关于win10安装wsl子系统Ubuntu图形界面的错误解决