示例#1
0
        // 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
0
        // Returns true if an Inline has one or more non-readonly local property values. 
        private static bool HasWriteableLocalPropertyValues(Inline inline)
        { 
            LocalValueEnumerator enumerator = inline.GetLocalValueEnumerator(); 
            bool hasLocalValues = false;
 
            while (!hasLocalValues && enumerator.MoveNext())
            {
                hasLocalValues = !enumerator.Current.Property.ReadOnly;
            } 

            return hasLocalValues; 
        }