public void UpdateParent(FastTextBlock ftb) { text = ftb.Text; props = new TextProps(ftb); }
public ParaProps(FastTextBlock tb) { this.tb = tb; props = new TextProps(tb); }
public void UpdateParent(FastTextBlock ftb) => parent = ftb;
public TextProps(FastTextBlock tb) { this.tb = tb; }
public static FrameworkElement Create(IClassificationFormatMap classificationFormatMap, string text, List<TextClassificationTag> tagsList, TextElementFlags flags) { bool useFastTextBlock = (flags & (TextElementFlags.TrimmingMask | TextElementFlags.WrapMask | TextElementFlags.FilterOutNewLines)) == (TextElementFlags.NoTrimming | TextElementFlags.NoWrap | TextElementFlags.FilterOutNewLines); bool filterOutNewLines = (flags & TextElementFlags.FilterOutNewLines) != 0; if (tagsList.Count != 0) { if (useFastTextBlock) { return new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0, new TextSrc { text = ToString(text, filterOutNewLines), classificationFormatMap = classificationFormatMap, tagsList = tagsList.ToArray(), }); } var propsSpans = tagsList.Select(a => new TextRunPropertiesAndSpan(a.Span, classificationFormatMap.GetTextProperties(a.ClassificationType))); var textBlock = TextBlockFactory.Create(text, classificationFormatMap.DefaultTextProperties, propsSpans, TextBlockFactory.Flags.DisableSetTextBlockFontFamily | TextBlockFactory.Flags.DisableFontSize | (filterOutNewLines ? TextBlockFactory.Flags.FilterOutNewlines : 0)); textBlock.TextTrimming = GetTextTrimming(flags); textBlock.TextWrapping = GetTextWrapping(flags); return textBlock; } FrameworkElement fwElem; if (useFastTextBlock) { fwElem = new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0) { Text = ToString(text, filterOutNewLines) }; } else { fwElem = new TextBlock { Text = ToString(text, filterOutNewLines), TextTrimming = GetTextTrimming(flags), TextWrapping = GetTextWrapping(flags), }; } return InitializeDefault(classificationFormatMap, fwElem); }