![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
WPF
文章平均质量分 68
chuwachen
这个作者很懒,什么都没留下…
展开
-
Dispatcher
Dispatcher 可为特定线程维护其按优先顺序排列的工作项队列。当在线程中创建了 Dispatcher 时,它将成为可与该线程关联的唯一 Dispatcher,即使 Dispatcher 已经关闭。如果尝试获取当前线程的 CurrentDispatcher,而此时该线程没有关联的 Dispatcher,则将创建一个Dispatcher。A Dispatcher在创建时还创建Dispatcher原创 2013-02-16 11:13:07 · 1064 阅读 · 0 评论 -
StaticResource vs DynamicResource
StaticResource转载 2014-08-18 16:50:14 · 763 阅读 · 0 评论 -
Markup Extensions for XAML
refer to http://msdn.microsoft.com/en-us/library/ee855815(v=vs.110).aspx转载 2014-08-22 15:12:51 · 503 阅读 · 0 评论 -
Set tooltip on customized tab header in WPF
in TextBlocks.xaml<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">原创 2014-05-06 15:28:01 · 540 阅读 · 0 评论 -
Template、ItemsPanel、ItemContainerStyle、ItemTemplate
Template是指控件的模板它代表的是一个控件的内部结构组成部分(Visual Tree)。如:Button的默认Template外面是一个边框,里面是文字描述。如果我们要把普通的文字Button改为图片按钮的话就必须要重写Button的模板,要在里面加上一个Image,即已经把Button的Template修改了。在WPF中所有继承自contentcontrol类的控件都含有此属性,(继承原创 2013-02-18 11:49:57 · 8571 阅读 · 0 评论 -
Data Binding
Usually you should define a decorator class for UI, for example,// if you want to update UI automatically when property "Title" is change, we need add code in green.public class DataBindingDeco原创 2012-12-20 18:28:15 · 1667 阅读 · 0 评论 -
WPF Template
1. 为什么用模板模板是用来定义(或重定义)对象的外观的好东西. WPF已经提供了Style来自定义外观, 那为什么还需要Template呢? 是因为Style只能让你一个一个地设置对象的属性, 但template用来改变对象的组织结构. Style就好象是更改一台电脑的配置, 你可以换个内存, 换个显卡, 但它还是一台电脑, 而Template则是把电脑整个换成一部汽车, 或者是转载 2013-02-18 14:51:27 · 8903 阅读 · 0 评论 -
How to add nested MenuItem dynamically
How to add sub items to "Second Item" dynamicallyIn xaml file // Initialize context menu event Second原创 2013-02-16 18:51:58 · 552 阅读 · 0 评论 -
How to choose WPF container controls
Usually you can set up the general layout with a Grid and use a few stackpanels here and there to do some specific stuff. Usually the performance is better with Grids and that Grids generally give you原创 2013-02-17 18:26:48 · 623 阅读 · 0 评论 -
Customize the border of the control
Create a border with dot line and round corner How to create a border as the following graph shows for example, the effect for mouse hover/selected a list box item (Code in green font原创 2013-02-16 18:35:45 · 531 阅读 · 0 评论 -
Margin vs Padding
padding用在容器内部,margin用在容器外部 如图所示: 比如:padding-top:10px;是指容器内的内容距离容器的顶部有10个像素,是包含在容器内的;margin-top:10px;是指容器本身的顶部距离其他容器有10个像素,不饱含在容器内转载 2013-02-17 14:51:04 · 446 阅读 · 0 评论 -
An easy way to customize a scrollbar for a control
If you want to customize a scrollbar for a control such as listbox as follows:You can define xaml as follows (wrap listbox with a scrollviewer): Then原创 2013-01-21 17:17:44 · 741 阅读 · 0 评论 -
How to bind listbox to data dynamically
In xamlInnerList"/>In xaml.csfor (int index = 0; index { ListBoxItem item = OuterList.ItemContainerGenerator.ContainerFromIndex(index) as原创 2013-02-17 14:08:04 · 502 阅读 · 0 评论 -
Auto vs *
Auto and * are definitely not the same.When talking about RowDefinitions, Auto means that the size of the elements in that row will determine the height of that row.* means that the row's height转载 2013-02-17 17:13:11 · 396 阅读 · 0 评论 -
PreviewXXX event and XXX event
Most controls in WPF inherit a series of events from the UIElement class such as PreviewMouseMove (tunneling) and MouseMove (bubbling) events.Because these events propagate, however, the events will转载 2013-02-17 12:41:35 · 776 阅读 · 0 评论