更新:2007 年 11 月
命名空间:
System.Windows.Documents 程序集:
PresentationFramework(在 PresentationFramework.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation
<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class TextElementEditingBehaviorAttribute _
Inherits Attribute
Dim instance As TextElementEditingBehaviorAttribute
[AttributeUsageAttribute(AttributeTargets.Class)]
public sealed class TextElementEditingBehaviorAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)]
public ref class TextElementEditingBehaviorAttribute sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */
public final class TextElementEditingBehaviorAttribute extends Attribute
public final class TextElementEditingBehaviorAttribute extends Attribute
<TextElementEditingBehaviorAttribute .../>
创建自定义文本元素时,可以使用 TextElementEditingBehaviorAttribute 属性指定应将该元素作为不可分割的单个实体进行处理。 如果将 IsMergeable 和 IsTypographicOnly 属性设置为 false,则当用户编辑 RichTextBox 时,RichTextBox 将保留该元素的边界和内容。 一般来讲,自定义元素的行为与 Hyperlink 的行为类似。 使用此类并将它的两个属性都设置为 false 时,将发生以下行为:
创建自定义元素时,若要在将该元素序列化到磁盘或剪贴板时保留自定义元素和属性值,可使用 TextRange..::.Save(Stream, String, Boolean) 方法并将 preserveTextElements 设置为 true。
.NET Framework 3.5 版中引入了 TextElementEditingBehaviorAttribute。有关更多信息,请参见 .NET Framework 3.5 体系结构。
System..::.Object
System..::.Attribute
System.Windows.Documents..::.TextElementEditingBehaviorAttribute
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
.NET Framework
受以下版本支持:3.5 SP1、3.0 SP1
参考