Avalonia
Avalonia copied to clipboard
Make Inline / TextElement inherit from InputElement to enable pointer/keyboard input handling
Is your feature request related to a problem? Please describe.
In order to implement Hyperlink inline pointer / keyboard input is required.
Describe the solution you'd like
Make Inline / TextElement inherit from InputElement to enable pointer/keyboard input handling
Describe alternatives you've considered
Embedding TextBlock's controls?
Additional context
https://github.com/AvaloniaUI/Avalonia/blob/d39b927266e18670f230b0fd16d58074f65dc512/src/Avalonia.Controls/Documents/Inline.cs#L11
https://github.com/AvaloniaUI/Avalonia/blob/d39b927266e18670f230b0fd16d58074f65dc512/src/Avalonia.Controls/Documents/TextElement.cs#L9
https://github.com/AvaloniaUI/Avalonia/blob/d39b927266e18670f230b0fd16d58074f65dc512/src/Avalonia.Base/Input/InputElement.cs#L21
The concrete implementation InputElement
should not be required to handle input in some inline. Inline itself is not a Visual so this will not be possible. Instead only IInputElement
should be required.
So how did you end up implementing this on your side?
So how did you end up implementing this on your side?
https://github.com/wieslawsoltes/HackerNews/blob/7f4593ac1b2ec92a3ad935c5a959c59c11a479ff/HackerNews/Controls/Hyperlink.cs#L14
I don't think this issue is solved. You are adding a styled button to the text layout. This issue is about making TextRun's hit testable for commands etc.