随笔分类 - -=WPF Tutorials=-
摘要:Routing Strategies:DirectBubblingTunnelingWHy use them?Any UIElement can be a listenerCommon handlersVisual Tree CommunicationEvent Setter and Event TriggerRouted Event Example: //listen to the RoutedEvent:ButtonBase.Click and handle RoutedEvent using Window_Click //listen to the Rou...
阅读全文
摘要:Limited functionality:Not settableNo data bindingNo validationNo animationNo InheritanceWhen to use?Used for state determination(Defined the style for the control, some visiable property like fore/background will change when mouse movehover)Used as a property trigger(由这个readonly property change,来cha
阅读全文
摘要:简单的DP注册:注意:Wrapper里的get,set永远不要写任何逻辑或者.Net提供的方法Text Wrapper只是一个helper,里面的get set永远不会被程序call到,breakpoint进不去。唯一可以进入set是直接对这个CLR property赋值。DP register的时候可以指定PropertyMetadata或者FrameworkPropertyMetadataPropertyMetadata:Specify default valuescoercionproperty change callbacksvalidation从上面简单DP register变过来的
阅读全文
摘要:TemplateBinding:TemplateBinding是一个Markup Extension1: 不适用在frezable property、controltemplate trigger、 two way binding、 value converter、only support Dependent Property。其实TemplateBinding是下面Text Binding的short cut。TemplateBinding有limitation,只能1way binding 到使用ControlTemplate的 Parent Control2:如果需要2way bindi
阅读全文
摘要:UserControlUserControl实际上就是ContentControl,xaml里tag之间包含的实际就是后台程序的UserControl.Content属性所付的值。如下UserControl.Content包含一个Grid,里面有TextBox和Button.所以可以run time改变usercontrol包含的内容。1:什么时候用UserControl:UserControl是多个已存在control组成的,为复用做准备(比如一个Context Form包含很多基础input,combobox textblock等,之后多次复用)不需要复杂的customzation的时候,
阅读全文

浙公网安备 33010602011771号