原文:WPF中如何选择合适的元数据标记?(英文)

FrameworkPropertyMetadataOptions Enumeration:
Specifies the types of framework-level property behavior that pertain to a particular dependency property in the Windows Presentation Foundation (WPF) property system.

  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.

Setting Appropriate Metadata Flags

  • If your property (and value changes to it) affects the user interface (UI), and in particular affects how the layout system should size or render your element in a page, set one or more of the following flags: AffectsMeasure, AffectsArrange, AffectsRender.

    • AffectsMeasure indicates that a change to this property requires a change to UI rendering where the containing object might require more or less space within the parent. For example, a "Width" property should have this flag set.

    • AffectsArrange indicates that a change to this property requires a change to UI rendering that typically does not require a change in the dedicated space, but does indicate that the positioning within the space has changed. For example, an "Alignment" property should have this flag set.

    • AffectsRender indicates that some other change has occurred that will not affect layout and measure, but does require another render. An example would be a property that changes a color of an existing element, such as "Background".

    • These flags are often used as a protocol in metadata for your own override implementations of property system or layout callbacks. For instance, you might have an OnPropertyChanged callback that will call InvalidateArrange if any property of the instance reports a value change and has AffectsArrange as true in its metadata.

  • Some properties may affect the rendering characteristics of the containing parent element, in ways above and beyond the changes in required size mentioned above. An example is the MinOrphanLines property used in the flow document model, where changes to that property can change the overall rendering of the flow document that contains the paragraph. Use AffectsParentArrange or AffectsParentMeasure to identify similar cases in your own properties.

  • By default, dependency properties support data binding. You can deliberately disable data binding, for cases where there is no realistic scenario for data binding, or where performance in data binding for a large object is recognized as a problem.

  • By default, data binding Mode for dependency properties defaults to OneWay. You can always change the binding to be TwoWay per binding instance; for details, see How to: Specify the Direction of the Binding. But as the dependency property author, you can choose to make the property use TwoWay binding mode by default. Examples in existing dependency properties include ; the scenario for this property is that the IsSubmenuOpen setting logic and the compositing of MenuItem interact with the default theme style. The IsSubmenuOpen property logic uses data binding natively to maintain the state of the property in accordance to other state properties and method calls. Another example property that binds TwoWay by default is TextBox.Text.

  • You can also enable property inheritance in a custom dependency property by setting the Inherits flag. Property inheritance is useful for a scenario where parent elements and child elements have a property in common, and it makes sense for the child elements to have that particular property value set to the same value as the parent set it. An example inheritable property is DataContext, which is used for binding operations to enable the important master-detail scenario for data presentation. By making DataContext inheritable, any child elements inherit that data context also. Because of property value inheritance, you can specify a data context at the page or application root, and do not need to respecify it for bindings in all possible child elements. DataContext is also a good example to illustrate that inheritance overrides the default value, but it can always be set locally on any particular child element; for details, see How to: Use the Master-Detail Pattern with Hierarchical Data. Property value inheritance does have a possible performance cost, and thus should be used sparingly; for details, see Property Value Inheritance.

  • Set the Journal flag to indicate if your dependency property should be detected or used by navigation journaling services. An example is the SelectedIndex property; any item selected in a selection control should be persisted when the journaling history is navigated.

暂时摘抄于此,有空细述。

WPF中如何选择合适的元数据标记?(英文)相关推荐

  1. wpf中xaml的类型转换器与标记扩展

    wpf中xaml的类型转换器与标记扩展 原文:wpf中xaml的类型转换器与标记扩展 这篇来讲wpf控件属性的类型转换器 类型转换器 类型转换器在asp.net控件中已经有使用过了,由于wpf的界面是 ...

  2. 开关电源中如何选择合适的电感

    电感是电路中常见的储能被动元器件,在开关电源的设计中起到滤波,升压,降压等作用.方案设计初期工程师不仅要选择合适的电感值,还要考虑电感可承受的电流,线圈的DCR,机械尺寸,损耗等等.如果对电感的功能不 ...

  3. 弱电系统怎么选择服务器,智能化弱电工程中如何选择合适的机柜?你知道吗?...

    许多人认为机柜是IT设备的机柜.机柜是机柜,但不只是这样. 对于计算机本身来说,机柜在UPS电源中也起着重要的辅助作用.良好的机柜意味着确保计算机能够在良好的环境中运行.机柜系统地解决了高密度散热.大 ...

  4. 数据分析报告中如何选择合适的统计图表

    由于不同的数据分析工具收集到的数据千差万别,基于这些数据生成展示的统计图表也不尽相同:而且数据分析师制作各种报告时,也常常纠结于如何选择合适的图表表达数据诉求,因此我们有必要去理解一些常用数据分析统计 ...

  5. 虹科教您 | 实时频谱分析仪中如何选择合适的FFT窗函数

    摘要 本文主要介绍了常见的窗函数以及窗函数有什么用,以及在实时频谱分析中,该如何选择合适的加窗方式. 随着无线通信的逐步发展,带来的是频谱环境的越发复杂与丰富,高度的信号变化性使得短时间内信号不再是一 ...

  6. mysql分窗函数_频谱分析中如何选择合适的窗函数

    加窗是为了减小泄漏! 1.信号截断及能量泄漏效应 数字信号处理的主要数学工具是傅里叶变换.应注意到,傅里叶变换是研究整个时间域和频率域的关系.然而,当运用计算机实现工程测试信号处理时,不可能对无限长的 ...

  7. mysql中辅导方式选择_MYSQL中如何选择合适的数据类型

    数值,典型代表为 tinyint,int,bigint 浮点/定点,典型代表为 float,double,decimal 以及相关的同义词 字符串,典型代表为 char,varchar 时间日期,典型 ...

  8. Pytorch-工业应用中如何选取合适的损失函数(MAE、MSE、Huber)

    正文: 无论在机器学习还是深度学习领域中,损失函数都是一个非常重要的知识点.损失函数有许多不同的类型,根据具体模型和应用场景需要选择不同的损失函数,如何选择模型的损失函数,是作为算法工程师实践应用中最 ...

  9. 工业应用中如何选取合适的损失函数(MAE、MSE、Huber)-Pytorch版

    作者丨小可乐大魔王@知乎  编辑丨极市平台 来源丨https://zhuanlan.zhihu.com/p/378822530 直接上结果: 图片截选自本文末尾 正文: 无论在机器学习还是深度学习领域 ...

  10. 在实际项目中,如何选择合适的机器学习模型?

    https://blog.csdn.net/gitchat/article/details/78913235 本文来自作者 chen_h 在 GitChat 上分享 「在实际项目中,如何选择合适的机器 ...

最新文章

  1. AI芯片结构目标图形处理
  2. Laravel: 基础篇
  3. java指针操作符_rxjava 操作符大全
  4. 「PKUWC2018」Slay the Spire
  5. HTTPS下导出excel失败解决办法
  6. 什么是java虚拟机?
  7. clang命令编译c++程序时报错
  8. version GLIBC_2.28 not found
  9. 微信小程序 23 播放音乐页
  10. 无线网卡无信号无服务器,无线网卡不能连接网络是什么原因?
  11. 【Unity2D】Sprite 或图片格式常用设置
  12. 配置环境变量的方法:putenv和setenv函数区别
  13. Windows 10 下 TeXstudio 深色背景主题的设置方法
  14. C++实验题8 数组使用(bushi)
  15. ubuntu18.04下载地址
  16. 嵌入式系统基础知识总结
  17. Angular 4入门教程系列:9:TypeScript:ECMAScript之前世今生
  18. Shader实战(1):Unity中使物体不受光照影响(不区分明暗面)
  19. JavaScript 双击禁止选中文字
  20. 教你正确选择光伏组件与逆变器!

热门文章

  1. 第七章 课后习题P206
  2. Delphi XE7的安卓程序如何调用JAVA的JAR,使用JAVA的类?
  3. JSP:Cookie实现永久登录(书本案例)
  4. 使用ODBC API读取Decimal或者Numeric
  5. 构建安全的 Web Services
  6. 关于TeamViewer中的ITbrain
  7. 如何在不卸载的情况下暂时禁用Tuxera NTFS
  8. Django中admin
  9. IDEA中新建ehcache.xml文件报错
  10. Centos6.7 64位安装配置kvm虚拟化