-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial implementation of TextBlock.Inlines #1689
Conversation
} | ||
else if (Count == 1) | ||
{ | ||
return ((IHasText)this[0]).Text ?? string.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If TextBlock contains only <LineBreak />
- this code throw exception. May be use "is IHasText"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, as always! :)
As I understand, you will not allow use TextElement into TextBlock? |
Sorry @Karnah - I don't understand? |
I didn't know that in TextBlock I can use
It's hard for me to decide, is it necessary to support |
@Karnah ok, I think I understand: yes what you're asking for is |
/// <param name="text">The text to format.</param> | ||
/// <returns>A <see cref="FormattedText"/> object.</returns> | ||
protected virtual FormattedText CreateFormattedText(Size constraint, string text) | ||
[Obsolete("Remove this")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just remove this anyway, since the next version is going to be 0.7 and we already have several other
breaking changes?
I have merged everything with the Skia text layout PR if someone wants to try this. |
Closing as this is superseded by #2423 |
This PR adds
TextBlock.Inlines
and a couple ofTextElement
s:Run
LineBreak
This allows one to format the text within a
TextBlock
, e.g.:Currently only works fully on Direct2D. The Skia backend currently only supports
Foreground
inFormattedText
- it will need to be updated with the new properties introduced in this PR. If anyone would like to implement these in Skia, please do!There are also more
TextElement
s to add, such asSpan
andInlineUIContainer
. These will come in a separate PR I think.