Exemple #1
0
        // Helper to set property value on element. 
        private static void SetPropertyValue(TextElement element, DependencyProperty property, object currentValue, object newValue) 
        {
            if (!TextSchema.ValuesAreEqual(newValue, currentValue)) 
            {
                // first clear and see if it will do
                element.ClearValue(property);
 
                // if still need it, set it
                if (!TextSchema.ValuesAreEqual(newValue, element.GetValue(property))) 
                { 
                    element.SetValue(property, newValue);
                } 
            }
        }
Exemple #2
0
		private void CopyProperties(TextElement source, TextElement target)
		{
			if (DependencyPropertyHelper.GetValueSource(source, Run.FontSizeProperty).BaseValueSource != BaseValueSource.Default)
				target.SetValue(Run.FontSizeProperty, source.FontSize);
			if (DependencyPropertyHelper.GetValueSource(source, Run.FontWeightProperty).BaseValueSource != BaseValueSource.Default)
				target.SetValue(Run.FontWeightProperty, source.FontWeight);
		}