随笔分类 -  wpf

(转)prism的MEF UNITY容器区别
摘要:http://akashkava.com/blog/391/mef-vs-unity-in-composite-application-prism/This article describes differences between MEF and Unity which may help you ... 阅读全文

posted @ 2015-08-03 14:17 oyl 阅读(1172) 评论(0) 推荐(0)

Freeable resource的特点
摘要:继承自Freeable的类(如Brush)拥有基本的改变跟踪机制,实质上就是会加一个change even handler给拥有它的目标类,它自身来抛出时间通知。这样就是让即使 Brush作为StaticResource,其自身属性改变时,也能在运行时更新; 在确定我们的系统中brush 不会变化时... 阅读全文

posted @ 2010-01-29 20:50 oyl 阅读(363) 评论(0) 推荐(0)

Wpf ItemsControl 开启UI Virtualization 的条件
摘要:ItemsControl支持UI virtualization1. VirtualizingStackpanel 作为ItemsPanel2. Set VirtualizingStackPanel.IsVirtualizing attach property为 true3.使用itemsSource... 阅读全文

posted @ 2010-01-14 10:51 oyl 阅读(760) 评论(1) 推荐(0)

让 wpf tabcontrol 延缓初始化每个tab item content
摘要:当手动增加tabItem给tab control时, 尽管只是显示第一个tab item的content, 但是每个tab item的content的都会被创建,这样会使得创建tab control时比较慢,特别是tab item很多,元素也很多的时候;,(这种情况下itemsControl 的U... 阅读全文

posted @ 2010-01-04 15:26 oyl 阅读(1699) 评论(0) 推荐(0)

Panel performance
摘要:程序: 有四个StackPanel意味着要执行四次measurement和arrangement,第一个父StackPanel让自己的三个孩子StackPanel执行measurement和arragement,这样性能损失严重,修改为:Grid> ... 阅读全文

posted @ 2009-12-08 20:44 oyl 阅读(314) 评论(1) 推荐(0)

StaticResource and DynamicResource 与 性能测试
摘要:WPF provides two ways to access a logical resource:•Statically with StaticResource, meaning the resource is applied only once (the first time it’s nee... 阅读全文

posted @ 2009-12-08 15:44 oyl 阅读(710) 评论(0) 推荐(0)

Focus scope in WPF
摘要:FocusScope 在wpf中起了很多作用,如logic focus,keyboard focus,每一个focus scope下可以有一个逻辑焦点;特别在routed command路由时, 默认情况下,routed command向上路由,当它发现一个新的focus scope时,会已新的fo... 阅读全文

posted @ 2009-08-24 14:35 oyl 阅读(586) 评论(0) 推荐(0)

CollectionView in WPF
摘要:wpf的集合controls, 都会有一个内在的viewmodel, 即ICollectionView;来支持sort ,filter, collection view 就是view modelwpf 根据data source 集合自动产生对应的collection view, ListColle... 阅读全文

posted @ 2009-07-01 12:43 oyl 阅读(834) 评论(0) 推荐(0)

MVC,MVP,MVVM(补充)
摘要:when evaluating a pattern, it is really important to at details such as:How are view and controller conntected?How an user action from the view is sen... 阅读全文

posted @ 2009-03-13 17:36 oyl 阅读(780) 评论(0) 推荐(0)

combo box bind to IEnumerable
摘要:public class XXXType : IEnumerable{public string SetType = "Set XXXX";public string NoXXX = "No XXXX;public string Year= "Year";public string Month= "... 阅读全文

posted @ 2009-03-10 19:22 oyl 阅读(182) 评论(0) 推荐(0)

Style based on a type
摘要:Style.BasedOn = {StaticResource "{X:Type my:XXXControl}"} 阅读全文

posted @ 2009-03-09 16:43 oyl 阅读(140) 评论(0) 推荐(0)

MVC,MVP,MVVM(model-view-viewModel
摘要:一.What is MVCA model is an object representing data or even activity, e.g. a database table or even some plant-floor production-machine process.A view... 阅读全文

posted @ 2009-01-17 17:18 oyl 阅读(1082) 评论(0) 推荐(0)

ItemsControl.filter
摘要:ItemsControl.Items.Filter = new Predicate(SetFilter);private bool SetFilter(object de){m_FilterCount++;Notification noti = de as Notification;if (noti... 阅读全文

posted @ 2009-01-04 21:16 oyl 阅读(286) 评论(0) 推荐(1)

Helper methods
摘要:////// Attempts to find the child framework element recursively from a given parent root object.//////the parent root object///the name of the child e... 阅读全文

posted @ 2009-01-04 16:29 oyl 阅读(480) 评论(5) 推荐(0)

Layout相关
摘要:1. 获得一个控件相对于另一个控件的位置//Vector vector = VisualTreeHelper.GetOffset(relativeControl);//Canvas.SetLeft(this,vector.X);//Canvas.SetTop(this, vector.Y);//UI... 阅读全文

posted @ 2008-12-25 20:01 oyl 阅读(259) 评论(0) 推荐(0)

动画相关
摘要:board.FillBehavior = FillBehavior.Stop 让动画结束后退出对目标属性的管理,这样目标属性的binding,set value 才能正常进行。 阅读全文

posted @ 2008-12-25 19:50 oyl 阅读(135) 评论(0) 推荐(0)

UIElement.CaptureMouse() and Mouse.Capture()
摘要:Capture mouse能够使 即使在控件之外也能够获取鼠标事件,拖,拉鼠标时最有用。When an element captures the mouse, it receives mouse input whether or not the cursor is within its border... 阅读全文

posted @ 2008-12-16 16:59 oyl 阅读(557) 评论(0) 推荐(0)

event handler in DataTemplate
摘要:在user control中,给data template加event handler很容易,因为user control的xaml是与cs编译成一个类, 有x:class tag. 但是在custom control 中,必须代码加入,而且要用visual tree找到data template中... 阅读全文

posted @ 2008-12-05 13:36 oyl 阅读(377) 评论(0) 推荐(0)

获得default control template of a control
摘要:方法有使用xamlpadX,blend工具, 还有用程序:privatestring GetDefinitionOfControlTemplate(ControlTemplate template) { XmlWriterSettings settings = newXmlWriterSettin... 阅读全文

posted @ 2008-11-30 14:11 oyl 阅读(183) 评论(0) 推荐(0)

获得DateTemplate中的element
摘要:比较困难的是用DataTemplate.FindName(string name,parent),需要知道这个datatemplate visual tree中的直系父亲,只要就是查找这个父亲了。例子: ItemsControl通过ItemContainerGenerator产生items,... 阅读全文

posted @ 2008-11-30 13:51 oyl 阅读(522) 评论(1) 推荐(0)

导航