Example #1
0
			public void UpdateParent(FastTextBlock ftb) {
				text = ftb.Text;
				props = new TextProps(ftb);
			}
Example #2
0
			public ParaProps(FastTextBlock tb) {
				this.tb = tb;
				props = new TextProps(tb);
			}
 public void UpdateParent(FastTextBlock ftb) => parent = ftb;
Example #4
0
			public TextProps(FastTextBlock tb) {
				this.tb = tb;
			}
Example #5
0
 public ParaProps(FastTextBlock tb)
 {
     this.tb = tb;
     props   = new TextProps(tb);
 }
Example #6
0
 public void UpdateParent(FastTextBlock ftb)
 {
     text  = ftb.Text;
     props = new TextProps(ftb);
 }
Example #7
0
 public TextProps(FastTextBlock tb)
 {
     this.tb = tb;
 }
Example #8
0
		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);
		}
Example #9
0
			public void UpdateParent(FastTextBlock ftb) => parent = ftb;