本文整理汇总了C#中System.Windows.Documents.Inline.ClearValue方法的典型用法代码示例。如果您正苦于以下问题:C# Inline.ClearValue方法的具体用法?C# Inline.ClearValue怎么用?C# Inline.ClearValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.Inline
的用法示例。
在下文中一共展示了Inline.ClearValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearFormattingInlineProperties
// Helper to clear formatting properties from passed inline element, preserving only non-formatting ones
private static void ClearFormattingInlineProperties(Inline inline)
{
// Clear all properties from this inline element
LocalValueEnumerator properties = inline.GetLocalValueEnumerator();
while (properties.MoveNext())
{
DependencyProperty property = properties.Current.Property;
// Skip readonly and non-formatting properties
if (property.ReadOnly || TextSchema.IsNonFormattingCharacterProperty(property))
{
continue;
}
inline.ClearValue(properties.Current.Property);
}
}
示例2: TransferStructuralProperties
// Copies all structural properties from source (clearing the property) to destination.
private static void TransferStructuralProperties(Inline source, Inline destination)
{
bool sourceIsChild = (source.Parent == destination);
for (int i = 0; i < TextSchema.StructuralCharacterProperties.Length; i++)
{
DependencyProperty property = TextSchema.StructuralCharacterProperties[i];
if ((sourceIsChild && HasLocalInheritableStructuralPropertyValue(source)) ||
(!sourceIsChild && HasLocalStructuralPropertyValue(source)))
{
object value = source.GetValue(property);
source.ClearValue(property);
destination.SetValue(property, value);
}
}
}