当前位置: 首页>>代码示例>>C#>>正文


C# Inline.ReadLocalValue方法代码示例

本文整理汇总了C#中System.Windows.Documents.Inline.ReadLocalValue方法的典型用法代码示例。如果您正苦于以下问题:C# Inline.ReadLocalValue方法的具体用法?C# Inline.ReadLocalValue怎么用?C# Inline.ReadLocalValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Documents.Inline的用法示例。


在下文中一共展示了Inline.ReadLocalValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckTextBlockInherited

		static public void CheckTextBlockInherited (Inline i)
		{
			Assert.AreEqual ("Portable User Interface", i.FontFamily.Source, "FontFamily");
			Assert.AreEqual (11, i.FontSize, "FontSize");
			Assert.AreEqual (DependencyProperty.UnsetValue, i.ReadLocalValue(Inline.FontSizeProperty), "FontSize local value");

			Assert.AreEqual (FontStretches.Normal, i.FontStretch, "FontStretch");
			Assert.AreEqual (FontStyles.Normal, i.FontStyle, "FontStyle");
			Assert.AreEqual (FontWeights.Normal, i.FontWeight, "FontWeight");

			Assert.IsNotNull (i.Foreground, "Foreground");
			Assert.AreEqual (Colors.Black, (i.Foreground as SolidColorBrush).Color, "Foreground.Color");
			Assert.AreEqual ("en-us", i.Language.IetfLanguageTag, "Language");
			Assert.IsNull (i.TextDecorations, "TextDecorations");
		}
开发者ID:dfr0,项目名称:moon,代码行数:15,代码来源:InlineTest.cs

示例2: InheritablePropertiesAreEqual

        // Compares a set of inheritable properties taken from two objects
        private static bool InheritablePropertiesAreEqual(Inline firstInline, Inline secondInline)
        { 
            Invariant.Assert(firstInline != null, "null check: firstInline");
            Invariant.Assert(secondInline != null, "null check: secondInline"); 
 
            // Compare inheritable properties
            DependencyProperty[] inheritableProperties = TextSchema.GetInheritableProperties(typeof(Inline)); 
            for (int i = 0; i < inheritableProperties.Length; i++)
            {
                DependencyProperty property = inheritableProperties[i];
 
                if (TextSchema.IsStructuralCharacterProperty(property))
                { 
                    if (firstInline.ReadLocalValue(property) != DependencyProperty.UnsetValue || 
                        secondInline.ReadLocalValue(property) != DependencyProperty.UnsetValue)
                    { 
                        return false;
                    }
                }
                else 
                {
                    if (!TextSchema.ValuesAreEqual(firstInline.GetValue(property), secondInline.GetValue(property))) 
                    { 
                        return false;
                    } 
                }
            }

            return true; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:31,代码来源:TextRangeEdit.cs

示例3: InlineToDesignItem

		private DesignItem InlineToDesignItem(Inline inline)
		{
			DesignItem d = d = designItem.Services.Component.RegisterComponentForDesigner(CloneInline(inline));
			if (inline is Run)
			{
				var run = inline as Run;

				if (run.ReadLocalValue(Run.TextProperty) != DependencyProperty.UnsetValue)
				{
					d.Properties.GetProperty(Run.TextProperty).SetValue(run.Text);
				}
			}
			else if (inline is Span)
			{ }
			else if (inline is LineBreak)
			{ }
			else
			{
				return null;
			}

			if (inline.ReadLocalValue(TextElement.BackgroundProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.BackgroundProperty).SetValue(inline.Background);
			if (inline.ReadLocalValue(TextElement.ForegroundProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.ForegroundProperty).SetValue(inline.Foreground);
			if (inline.ReadLocalValue(TextElement.FontFamilyProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.FontFamilyProperty).SetValue(inline.FontFamily);
			if (inline.ReadLocalValue(TextElement.FontSizeProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.FontSizeProperty).SetValue(inline.FontSize);
			if (inline.ReadLocalValue(TextElement.FontStretchProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.FontStretchProperty).SetValue(inline.FontStretch);
			if (inline.ReadLocalValue(TextElement.FontStyleProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.FontStyleProperty).SetValue(inline.FontStyle);
			if (inline.ReadLocalValue(TextElement.FontWeightProperty) != DependencyProperty.UnsetValue)
				d.Properties.GetProperty(TextElement.FontWeightProperty).SetValue(inline.FontWeight);
			if (inline.TextDecorations.Count > 0)
			{
				d.Properties.GetProperty("TextDecorations").SetValue(new TextDecorationCollection());
				var tdColl = d.Properties.GetProperty("TextDecorations");

				foreach (var td in inline.TextDecorations)
				{
					var newTd = designItem.Services.Component.RegisterComponentForDesigner(new TextDecoration());
					if (inline.ReadLocalValue(TextDecoration.LocationProperty) != DependencyProperty.UnsetValue)
						newTd.Properties.GetProperty(TextDecoration.LocationProperty).SetValue(td.Location);
					if (inline.ReadLocalValue(TextDecoration.PenProperty) != DependencyProperty.UnsetValue)
						newTd.Properties.GetProperty(TextDecoration.PenProperty).SetValue(td.Pen);

					tdColl.CollectionElements.Add(newTd);
				}
			}
			
			return d;
		}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:54,代码来源:FormatedTextEditor.xaml.cs

示例4: CloneInline

		private Inline CloneInline(Inline inline)
		{
			Inline retVal = null;
			if (inline is LineBreak)
				retVal = new LineBreak();
			else if (inline is Span)
				retVal = new Span();
			else if (inline is Run)
			{
				retVal = new Run(((Run) inline).Text);
			}

			if (inline.ReadLocalValue(Inline.BackgroundProperty) != DependencyProperty.UnsetValue)
				retVal.Background = inline.Background;
			if (inline.ReadLocalValue(Inline.ForegroundProperty) != DependencyProperty.UnsetValue)
				retVal.Foreground = inline.Foreground;
			if (inline.ReadLocalValue(Inline.FontFamilyProperty) != DependencyProperty.UnsetValue)
				retVal.FontFamily = inline.FontFamily;
			if (inline.ReadLocalValue(Inline.FontSizeProperty) != DependencyProperty.UnsetValue)
				retVal.FontSize = inline.FontSize;
			if (inline.ReadLocalValue(Inline.FontStretchProperty) != DependencyProperty.UnsetValue)
				retVal.FontStretch = inline.FontStretch;
			if (inline.ReadLocalValue(Inline.FontStyleProperty) != DependencyProperty.UnsetValue)
				retVal.FontStyle = inline.FontStyle;
			if (inline.ReadLocalValue(Inline.FontWeightProperty) != DependencyProperty.UnsetValue)
				retVal.FontWeight = inline.FontWeight;
			if (inline.ReadLocalValue(Inline.TextEffectsProperty) != DependencyProperty.UnsetValue)
				retVal.TextEffects = inline.TextEffects;
			if (inline.ReadLocalValue(Inline.TextDecorationsProperty) != DependencyProperty.UnsetValue)
				retVal.TextDecorations = inline.TextDecorations;

			return retVal;
		}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:33,代码来源:FormatedTextEditor.xaml.cs


注:本文中的System.Windows.Documents.Inline.ReadLocalValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。