public static bool TryCreate(Inline inline, out ImageInline imageInline) { imageInline = null; if (null == inline) { return false; } if (!IsImageInline(inline)) { return false; } Span span = inline as Span; Run imagePath = span.Inlines[0] as Run; Run caption = span.Inlines[1] as Run; imageInline = new ImageInline { FilePath = imagePath.Text, Caption = caption.Text }; return true; }
public Paragraph AddToParentParagraph(Inline text) { var paragraph = new Paragraph(); paragraph.Inlines.Add(text); Add(paragraph); return paragraph; }
public virtual void Add(Inline inline) { var paragraph = _richTextBlock.Blocks.LastOrDefault() as Paragraph; if (paragraph == null) { paragraph = new Paragraph(); paragraph.Inlines.Add(inline); Add(paragraph); } else { paragraph.Inlines.Add(inline); } }
public static ImageInline Create(Inline inline) { if (null == inline) { throw new ArgumentNullException("inline"); } if (!IsImageInline(inline)) { throw new ArgumentException("Inline is not an image inline", "inline"); } ImageInline result; if (!TryCreate(inline, out result)) { throw new InvalidOperationException("Failed to create image inline"); } return result; }
public static bool IsImageInline(Inline inline) { bool isImageSpan = IsImageSpan(inline); bool isImageUIInline = IsImageInlineUIElement(inline); return isImageSpan || isImageUIInline; }
private void outp(Inline r) { runOnUiThread(() => outp_ui(r)); }
private void outp_ui(Inline r) { var count = rtbConsole.Blocks.Count - blankLines; // ignore blank lines at end var idx = count - 1; var p = ((Paragraph)rtbConsole.Blocks[0]); var loc = p.Inlines.Count - 3; p.Inlines.Insert(loc, r); ScrollToBottom(); }
public virtual void Add(Inline inline) { _paragraph.Inlines.Add(inline); }
/// <summary> /// Checks whether an Inline has a typographical effect within a given TextBlock /// </summary> /// <param name="inline">The Inline for which we want to check the typographical effectiveness</param> /// <param name="textBlock">The TextBlock within which we want to check the Inline's typographical effectiveness</param> /// <returns>Whether the Inline has a typographical effect within the given TextBlock</returns> internal static bool HasTypographicalEffectWithin(this Inline inline, TextBlock textBlock) { return(inline is Run run && run.Text != string.Empty && !inline.IsTypographicallyEquivalentTo(textBlock)); }
internal static string ToPlainText(Inline inline) { string result = string.Empty; ImageInline imageInline; if (TryCreate(inline, out imageInline)) { result = string.Format(PlainTextFormat, imageInline.FilePath, imageInline.Caption); } return result; }
/// <summary> /// Update the properties on the inline instance. /// </summary> /// <param name="inline">The instance.</param> public override void UpdateInline(Inline inline) { inline.CharacterSpacing = _letterSpacing; inline.FontSize = _fontSize ?? 15; inline.FontStyle = _fontStyle ?? FontStyle.Normal; inline.FontWeight = _fontWeight ?? FontWeights.Normal; inline.FontFamily = _fontFamily != null ? new FontFamily(_fontFamily) : FontFamily.XamlAutoFontFamily; }
/// <inheritdoc /> public bool Remove(Inline item) => _collection.Remove(item);
/// <summary> /// Update the properties on the inline instance. /// </summary> /// <param name="inline">The instance.</param> public override void UpdateInline(Inline inline) { ((Run)inline).Text = _text; }
/// <inheritdoc /> public void Add(Inline item) => _collection.Add(item);
/// <inheritdoc /> public bool Contains(Inline item) => _collection.Contains(item);
public static void SetFormattedText(DependencyObject obj, Inline value) { obj.SetValue(FormattedTextProperty, value); }
public Paragraph AddToParentParagraph(Inline text) => _parent.AddToParentParagraph(text);
public void Add(Inline text) { _span.Inlines.Add(text); }
private static bool IsImageInlineUIElement(Inline inline) { InlineUIContainer container = inline as InlineUIContainer; return null != container && container.Child.GetType() == typeof(Image); }
public void Add(Inline text) { _block.Inlines.Add(text); }
private static bool IsImageSpan(Inline inline) { Span span = inline as Span; bool isImageSpan = null != span && inline.GetType() == typeof(Span) && span.Inlines.Count == 2 && InvisibleRun.IsInvisible(span.Inlines[0] as Run) && !InvisibleRun.IsInvisible(span.Inlines[1] as Run); return isImageSpan; }
public void Add(Inline text) { var paragraph = new Paragraph(); paragraph.Inlines.Add(text); Add(paragraph); }
/// <inheritdoc /> public int IndexOf(Inline item) => _collection.IndexOf(item);
public void Add(Inline text) { //throw new NotSupportedException(); var paragraph = new Paragraph(); paragraph.Inlines.Add(text); _richTextBlock.Blocks.Add(paragraph); }
public void Add(Inline inline) { _span.Inlines.Add(inline); }
/// <inheritdoc /> public void Insert(int index, Inline item) => _collection.Insert(index, item);
public Paragraph AddToParentParagraph(Inline text) { Add(text); return _block; }
/// <summary> /// Update the properties on the inline instance. /// </summary> /// <param name="inline">The instance.</param> public abstract void UpdateInline(Inline inline);
public void Add(Inline inline) { _innerContainer.Add(inline); }
public virtual void Add(Inline inline) { var paragraph = new Paragraph(); paragraph.Inlines.Add(inline); Add(paragraph); }