zoukankan
html css js c++ java
WPF笔记(1.3 属性元素)——Hello,WPF!
这一节中“属性元素”的概念可以用匪夷所思形容。
1。WPF用标签元素实现对象建模,有两种:Control和Container,都用来装载内容和行为,前者如Button,后者如Window。
你可以这样写:
<
Window
>
<
Button Width
=
"
100
"
Height
=
"
100
"
>
<
Image Source
=
"
tom.png
"
/>
</
Button
>
</
Window
>
也可以这样:
<
Window
>
<
Button Width
=
"
100
"
Height
=
"
100
"
>
<
TextBox Width
=
"
75
"
>
edit me
</
TextBox
>
</
Button
>
</
Window
>
就是说,将原来Button的Image属性和TextBox属性当作对象提取出来。这是因为Button起源于一个类:
ContentControl
,该类知道如何生成其装载的所有控件。
2。其实完整的写法是这样的:
<
Button Width
=
"
100
"
Height
=
"
100
"
>
<
Button.Content
>
<
Image Source
=
"
tom.png
"
/>
</
Button.Content
>
</
Button
>
但是,<Button.Content>标签内不能有两个控件,会显示语法错误,只能是一个属性元素——这时候要用Panel。
Window控件有和Button同样的用法,见下面章节。
查看全文
相关阅读:
Java 基础
Mybatis
Gateway
Debug
Nacos
Debug
Debug
echars 折线图之一条线显示不同颜色,及拐点显示不同颜色
捌月份生活随笔
MyMatrix2022 64位版本下载 64bits Edition
原文地址:https://www.cnblogs.com/Jax/p/691835.html
最新文章
全栈微信小程序商城 学习笔记8.1 theme简要信息接口编写
使用矩不变量匹配图像
常用css与xpath速查表
ZABBIX数据库表结构解析
8.30JavaWeb之XML概念
8.30Go之数据类型转换
8.30Go之字符类型(byte和rune)
8.28Go之容器之nil
8.28Go之指针
8.27Go之容器之list
热门文章
8.27Go之容器之syncMap
8.27Go之容器之range循环迭代切片
8.26Go之容器之多维切片
8.26Go之容器之Map(映射)
MySQL
MySQL
Financial
SpringCloud Alibaba- 分布式文件存储 OSS
Mybatis
Network
Copyright © 2011-2022 走看看