Changing the CompletionItem upon committing

SyntaxEditor for WPF Forum

Posted 13 years ago by Kasper
Version: 11.1.0545

With SyntaxEditor for WinForms, I was able to make changes to a completion item before the intelliprompt list was closed. I need this, for instance, to invoke a dialog when selecting items of a certain types and then replace the selected item text with the result from the dialog. I found the Committing event on the CompletionSession class, and while it doesn't really give me direct access to e.g. the selected item and so on, through the eventargs, as I was used to with SE for WinForms, I was able to access the selected item by going through the sender object, which is fortunately of the CompletionSession type. I then expected to be able to alter the Pre and Post text, as with SE for WinForms, and the documentation indicates that I can ("Gets or sets the text that is inserted into the document before...."), but when I try to set it, the compiler tells me that it's read only:

Property or indexer 'ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt.ICompletionItem.AutoCompletePreText' cannot be assigned to -- it is read only

Is that a bug or am I missing something obvious here? :)

Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Kasper,

The ICompletionItem properties are read-only (and the "Gets or sets" documentation is a copy/paste issue there that we'll fix) but if you cast it to the CompletionItem class, those properties are read/write.

Actipro Software Support

Posted 13 years ago by Kasper
Excellent, that works. I hope you will consider to make this available through the eventargs again, since that really makes the most sense - imo :)
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.