本文整理汇总了C#中TextRange.ApplyPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# TextRange.ApplyPropertyValue方法的具体用法?C# TextRange.ApplyPropertyValue怎么用?C# TextRange.ApplyPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextRange
的用法示例。
在下文中一共展示了TextRange.ApplyPropertyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypefaceListItem
public TypefaceListItem(Typeface typeface)
{
_displayName = GetDisplayName(typeface);
_simulated = typeface.IsBoldSimulated || typeface.IsObliqueSimulated;
this.FontFamily = typeface.FontFamily;
this.FontWeight = typeface.Weight;
this.FontStyle = typeface.Style;
this.FontStretch = typeface.Stretch;
string itemLabel = _displayName;
if (_simulated)
{
string formatString = Properties.FontDialogResources.ResourceManager.GetString(
"simulated",
CultureInfo.CurrentUICulture
);
itemLabel = string.Format(formatString, itemLabel);
}
Text = itemLabel;
ToolTip = itemLabel;
// In the case of symbol font, apply the default message font to the text so it can be read.
if (FontFamilyListItem.IsSymbolFont(typeface.FontFamily))
{
var range = new TextRange(ContentStart, ContentEnd);
range.ApplyPropertyValue(TextBlock.FontFamilyProperty, SystemFonts.MessageFontFamily);
}
}
示例2: FontFamilyListItem
public FontFamilyListItem(FontFamily fontFamily)
{
_displayName = GetDisplayName(fontFamily);
this.FontFamily = fontFamily;
this.Text = _displayName;
this.ToolTip = _displayName;
// In the case of symbol font, apply the default message font to the text so it can be read.
if (IsSymbolFont(fontFamily))
{
var range = new TextRange(ContentStart, ContentEnd);
range.ApplyPropertyValue(TextBlock.FontFamilyProperty, SystemFonts.MessageFontFamily);
}
}