public static TextBlock ToRun(this TaggedText text, bool isBold = false) { var s = text.ToVisibleDisplayString(includeLeftToRightMarker: false); var run = new TextBlock { Text = s }; if (isBold) { run.FontWeight = FontWeight.Bold; } switch (text.Tag) { case TextTags.Keyword: run.Foreground = Brushes.Blue; break; case TextTags.Struct: case TextTags.Enum: case TextTags.TypeParameter: case TextTags.Class: case TextTags.Delegate: case TextTags.Interface: run.Foreground = Brushes.Teal; break; } return(run); }
public static Run ToRun(this TaggedText part, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var text = part.ToVisibleDisplayString(includeLeftToRightMarker: true); var run = new Run(text); var format = formatMap.GetTextProperties(typeMap.GetClassificationType( part.Tag.ToClassificationTypeName())); run.SetTextProperties(format); return(run); }
public static Run ToRun(this TaggedText text) { var s = text.ToVisibleDisplayString(includeLeftToRightMarker: true); var run = new Run(s) { FontSize = 12, FontWeight = FontWeights.Normal, Foreground = text.Tag switch { TextTags.Keyword => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0xF9, 0x26, 0x72)), TextTags.Struct => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0x56, 0xD9, 0xEF)), TextTags.Enum => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0x56, 0xD9, 0xEF)), TextTags.TypeParameter => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0x56, 0xD9, 0xEF)), TextTags.Class => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0x56, 0xD9, 0xEF)), TextTags.Delegate => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0x56, 0xD9, 0xEF)), TextTags.Interface => Caches.GetSolidColorBrush(new ByteColor(0xFF, 0x56, 0xD9, 0xEF)), _ => Caches.GetSolidColorBrush(ByteColor.White) } }; return(run); }
public static Run ToRun(this TaggedText text) { var s = text.ToVisibleDisplayString(includeLeftToRightMarker: true); var run = new Run(s); switch (text.Tag) { case TextTags.Keyword: run.Foreground = Brushes.Blue; break; case TextTags.Struct: case TextTags.Enum: case TextTags.TypeParameter: case TextTags.Class: case TextTags.Delegate: case TextTags.Interface: run.Foreground = Brushes.Teal; break; } return(run); }