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同样的用法,见下面章节。
查看全文
相关阅读:
ECharts中悬浮图标tooltie多行显示已解决
Linux中的$符号的三种常见用法
Shell逐行读取文件的4种方法
rename
nodejs安装
“ArcGIS Desktop遇到严重的应用程序错误,无法继续”的解决方案
跟我一起学Redis之Redis持久化必知必会
微服务很香--麻辣味,但要慢慢消化
跟我一起学Redis之Redis事务简单了解一下
跟我一起学.NetCore之EF Core 实战入门,一看就会
原文地址:https://www.cnblogs.com/Jax/p/691835.html
最新文章
pytorch 怎么用tensorboard 可视化
ioctl获取本机IP和MAC地址
VMware Workstation cannot connect to the virtual machine. Make sure you have rights to run the program, access all directories the program uses, and access all directories for temporary files.
汉字编码之GBK编码
Unicode 和 UTF-8 有什么区别?
Ubuntu Server16.04 开机A start job is running for Raise network interface(5min 1s)
Linux系统下深究一个malloc/brk/sbrk新内存后的page fault问题
Linux内存管理 —— 文件系统缓存和匿名页的交换
tcmalloc相关内存未释放
LINUX GDB: IDENTIFY MEMORY LEAKS(通过gdb脚本打印malloc和free)
热门文章
利用dmesg和addr2line来对(动态库里的)段错误进行调试
Linux性能优化总结
linux环境下进程kill排查及strace使用
Linux程序内存越界定位分析杂谈2
Linux程序内存越界定位分析
Java日期字符串类型转Date类
Java校招笔试题
HttpServletRequest.getInputStream() 多次获取post的数据
SpringBoot中filter的使用详解及原理
springboot获取当前项目所有URL和URL描述
Copyright © 2011-2022 走看看