Controltemplate datatemplate
DataTemplate ControlTemplate
- we can search many posts about this topic. some valuable link: DataTemplate和ControlTemplate的关系,
- we can see some definition about ControlTemplate, DataTemplate, HierarchicalDataTemplate
2.1. A ControlTemplate is used to define/change the way a class derived from Control looks, such as Buttons, ListBox, ScrollBar. However, some "Controls" you use are not derived from Control: Best example is the TextBlock class. The TextBlock cannot have a ControlTemplate.
ControlTemplate is connected to the Template property of the Control, we can set it directly to the property.
2.2 DataTemplate is closelly linked with the “Content” in WPF. Certain controls are made to display "Content". Content can be anything, such as Image, Text, Object.... in fact, it is defined as an "object" type. The DataTemplate simply defines how a particular content (or content type) is meant to be displayed.
DataTemplate is used to display Content of a Control, the Relative property is CellTemplate,ContentTemplate,ItemTemplate.
2.3. HierarchicalDataTemplate is an extension of DataTemplate with an additional ItemSource property. It is used to render hierarchical data in controls like treeview or menu.
Example: Usually, a string is displayed using a simple TextBlock... However, if you want a custom text layout, decoration, alignement, ... you would need to define an Alternate DataTemplate.
- the relationship of these concept.
Control类型
- Template属性 (ControlTemplate类型)
- ContentPresenter
- ContentTemplate (DataTemplate类型)
ContentControl类型
- Template属性 (ControlTemplate类型) 继承自Control
- ContentTemplate (DataTemplate类型)
ItemsControl类型
- Template属性 (ControlTemplate类型) 继承自Control
- ItemsPanel属性 (ItemsPanelTemplate类型) 指定布局容器
- ItemTemplate属性 (DateTemplate类型) 每个Item的Template
***
ListBox controltemplate Datatemplate.
- ListBox.template : controltemplate
Controltemplate datatemplate的更多相关文章
- WPF ControlTemplate,DataTemplate
The Control Template defines the visual appearance of a control. All of the UI elements have some ki ...
- 背水一战 Windows 10 (76) - 控件(控件基类): Control - 基础知识, 焦点相关, 运行时获取 ControlTemplate 和 DataTemplate 中的元素
[源码下载] 背水一战 Windows 10 (76) - 控件(控件基类): Control - 基础知识, 焦点相关, 运行时获取 ControlTemplate 和 DataTemplate 中 ...
- WPF DataTemplate與ControlTemplate
一. 前言 什麼是DataTemplate? 什麼是ControlTemplate? 在stackoverflow有句簡短的解釋 "A DataTemplate, therefore ...
- [No000012F]WPF(7/7) - 样式,触发器和动画
WPF Tutorial : Beginning [^] WPF Tutorial : Layout-Panels-Containers & Layout Transformation [^] ...
- WPF 中那些可跨线程访问的 DispatcherObject(WPF Free Threaded Dispatcher Object)
原文 WPF 中那些可跨线程访问的 DispatcherObject(WPF Free Threaded Dispatcher Object) 众所周知的,WPF 中多数对象都继承自 Dispatch ...
- WPF学习目录
基本概念 数据源Source-目标Target WPF生命周期 App.xaml 依赖属性 WPF路由 线程操纵UI问题 利用属性中设置.查看DataContext/Command等 分析布局 写数据 ...
- WPf 带滚动条WrapPanel 自动换行 和控件右键菜单
原文:WPf 带滚动条WrapPanel 自动换行 和控件右键菜单 技能点包括 WPf 样式的引用 数据的验证和绑定 比较适合初学者 前台: <Window.Resources> < ...
- WPF 判断一个对象是否是设计时的窗口类型,而不是运行时的窗口
原文:WPF 判断一个对象是否是设计时的窗口类型,而不是运行时的窗口 当我们对 Window 类型写一个附加属性的时候,在属性变更通知中我们需要判断依赖对象是否是一个窗口.但是,如果直接判断是否是 W ...
- WPF源代码分析系列一:剖析WPF模板机制的内部实现(一)
众所周知,在WPF框架中,Visual类是可以提供渲染(render)支持的最顶层的类,所有可视化元素(包括UIElement.FrameworkElment.Control等)都直接或间接继承自Vi ...
随机推荐
- 【drp 1】使用易宝实现在线支付
导读:在很多网站上,都会涉及到在线支付的功能,总所周知的有:淘宝.天猫.京东等等.我们常见的支付方式有支付宝.微信钱包.银行卡支付等.本篇博客,将介绍一种使用易宝第三方软件进行在线支付的功能. 一.基 ...
- centos custom iso
http://www.smorgasbork.com/2012/01/04/building-a-custom-centos-6-kickstart-disc-part-1/ Create a dir ...
- WF4.0 自定义CodeActivity与Bookmark<第三篇>
一.自定义CodeActivity CodeActivity用于自定义一段代码,可实现你自己写的任意功能. 要注意的有两点: 1.自定义CodeActivity必须继承自CodeActivity; 2 ...
- WWF3常用类 <第十一篇>
一.WorkflowRuntime类 System.Workflow.Runtime.WorkflowRuntime是工作流的运行引擎.WorkflowRuntime在宿主中以自己独立的线程运行,它可 ...
- jquery的end(),addBack()方法example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- JS与JQ倒计时的写法
页面需要制作一个倒计时的功能:然后度娘了一遍,找到两种写法,原生JS与JQ 的,经过测试原生JS在IE可能会有不刷新的现象所以结合了一个大神的JQ写法修改好了一个. 原生JS写法: HTML: < ...
- Windows server 2008 R2远程桌面终端连接数的破解
Windows server 2008 R2远程桌面终端连接数的破解 日常工作中,经常需要远程连接到服务器上,然而在公司里,老总.同事都需要连接到服务器上,而默认的服务器系统同时连接的最大连接数只有2 ...
- MIPS平台移植apache 2.2.7
参考文章: http://wenku.baidu.com/view/94e08a20a5e9856a561260e2.html http://httpd.apache.org/docs/2.4/ins ...
- nginx url重写 rewrite实例
本文介绍下,在nginx中实现Url重写,学习rewrite的具体用法,有需要的朋友参考下吧. 原文地址:http://www.360doc.com/content/14/0202/20/142341 ...
- eclipse 中maven项目右键没有maven菜单问题
修改项目.project文件,确保有maven2Builder和maven2Nature2个标签: <?xml version="1.0" encoding="UT ...