AvaloniaUI / AvaloniaEdit

Avalonia-based text editor (port of AvalonEdit)
MIT License
760 stars 148 forks source link

Problem with displaying the auto-completion list #449

Closed gsa-m closed 1 month ago

gsa-m commented 2 months ago

The list display problems start with Avalonia version 11.1.0 (the previous version 11.0.13 works correctly).

Error: [Binding]An error occurred binding 'Content' to 'Content' at 'Content': 'Unable to cast object of type 'System.String' to type 'AvaloniaEdit.CodeCompletion.ICompletionData'.' (ContentPresenter #48657561)

2024-08-23_10-46-54

mgarstenauer commented 2 months ago

I am seeing the same issue (Avalonia 11.1.3, AvaloniaEdit 11.1.0). Changing the control template here to

<ContentPresenter Content="{Binding Content, Mode=OneTime}" />

fixes the issue – at least in my app. Not sure what the underlying cause is. Some changes in the binding system?

AlexKerman commented 1 month ago

Another solution (in a ICompletionData implementarion):

public object Content => this;

Be careful it may lead to StackOverflow