Some tips
1. UIPropertyMetadata and FrameworkPropertyMetadata
- UIPropertyMetaData Provides property metadata for non-framework properties that do have rendering/user interface impact at the core level.
构造函数:
UIPropertyMetadata()
UIPropertyMetadata(default Object)
UIPropertyMetadata(PropertyChangedCallback)
UIPropertyMetadata(default Object, PropertyChangedCallback)
UIPropertyMetadata(default Object, PropertyChangedCallback, CoerceValueCallback)
UIPropertyMetadata(Object, PropertyChangedCallback, CoerceValueCallback, Boolean) a Boolean used to disable animations on the property.
UIElement主要负责路由事件,命令帮定,布局,焦点的可视对象基类。
- FrameworkPropertyMetadata:UIPropertyMetadata
FrameworkPropertyMetadata Reports or applies metadata for a dependency property, specifically adding framework-specific property system characteristics.
FrameworkPropertyMetadata 最大的优势是有一个FrameworkPropertyMetadataOptions在构造函数中 ,
These options specify characteristics of the dependency property that interact with systems such as layout or data binding. Can be Combination of optiongs below:
Member name Description
None : No options are specified; the dependency property uses the default behavior of the Windows Presentation Foundation (WPF) property system.
AffectsMeasure: The measure pass of layout compositions is affected by value changes to this dependency property.
AffectsArrange: The arrange pass of layout composition is affected by value changes to this dependency property.
AffectsParentMeasure: The measure pass on the parent element is affected by value changes to this dependency property.
AffectsParentArrange: The arrange pass on the parent element is affected by value changes to this dependency property.
AffectsRender :Some aspect of rendering or layout composition (other than measure or arrange) is affected by value changes to this dependency property. 当属性值改变时,要求子元素重新呈现。
Inherits :The values of this dependency property are inherited by child elements.
OverridesInheritanceBehavior: The values of this dependency property span separated trees for purposes of property value inheritance.
NotDataBindable: Data binding to this dependency property is not allowed.
BindsTwoWayByDefault: The BindingMode for data bindings on this dependency property defaults to TwoWay.
Journal: The values of this dependency property should be saved or restored by journaling processes, or when navigating by Uniform resource identifiers (URIs).
SubPropertiesDoNotAffectRender:The subproperties on the value of this dependency property do not affect any aspect of rendering.
使用:FrameworkPropertyMetadataOptions.AffectsRender |
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault),
FrameworkElement支持样式,数据帮定,资源和一些通用机制的windows控件,如tooltip, contextmenu等。
2。 How to new line in xaml string attribute
<LineBreak/> or