You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
BACKGROUND
I'm trying to add a clickable styled link within SelectableTextBlock. First off, HyperLinkButton doesn't work for me because it has styling and padding which disrupts the flow of the text. I particularly wish to style the link myself. So I opted to derive a class from TextBlock and add it to the SelectableTextBlock via InlineUIContainer.
All well and good.
THE PROBLEM
The problem is that selecting text which includes an InlineUIContainer ignores the text within the container. Looking at the Avalonia code, it seems just to ignore it. I can't seem to override anything because all the required methods to do so are internal.
So when copied, the text in the screenshot below comes out as:
This is .
Forgive the olive background in the above. It's just for test. :)
Q. So, if there is a current way to do this which I'm missing, please do let me know????
Otherwise, I have a suggestion...
Describe the solution you'd like
If I could override InlineUIContainer.AppendText(), then the first thing I would try is this:
internal override void AppendText(StringBuilder stringBuilder)
{
// OPTION 1
// This way I can put any object I like in there and override its ToString() method
stringBuilder.Append(Child.ToString());
// OPTION 2
// Or restrict to TextBlock...
if (Child is TextBlock block)
{
stringBuilder.Append(block.Text);
}
}
Additionally, or alternatively, I suggest to consider making InlineUIContainer.AppendText() protected scope so it can be extended.
Describe alternatives you've considered
Everything under the Sun, but I always run into an internal an method at the very end. :(
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
BACKGROUND
I'm trying to add a clickable styled link within
SelectableTextBlock
. First off,HyperLinkButton
doesn't work for me because it has styling and padding which disrupts the flow of the text. I particularly wish to style the link myself. So I opted to derive a class fromTextBlock
and add it to theSelectableTextBlock
viaInlineUIContainer
.All well and good.
THE PROBLEM
The problem is that selecting text which includes an
InlineUIContainer
ignores the text within the container. Looking at the Avalonia code, it seems just to ignore it. I can't seem to override anything because all the required methods to do so areinternal
.So when copied, the text in the screenshot below comes out as:
This is .
Forgive the olive background in the above. It's just for test. :)
Q. So, if there is a current way to do this which I'm missing, please do let me know????
Otherwise, I have a suggestion...
Describe the solution you'd like
If I could override
InlineUIContainer.AppendText()
, then the first thing I would try is this:Additionally, or alternatively, I suggest to consider making
InlineUIContainer.AppendText()
protected scope so it can be extended.Describe alternatives you've considered
Everything under the Sun, but I always run into an internal an method at the very end. :(
Additional context
No response
The text was updated successfully, but these errors were encountered: