This is a migrated thread and some comments may be shown as answers.

Document not Showing

3 Answers 164 Views
SyntaxEditor
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 11 Dec 2019, 09:49 AM

Hallo,

I am using this code to fill the Editor With code:

public void Test()
{
    using (StreamReader reader = new StreamReader("../../ViewModels/ShellViewModel.cs", Encoding.UTF8))
    {
        SyntaxEditor.Document = new TextDocument(reader);
    }
    CSharpTagger cSharpTagger = new CSharpTagger(SyntaxEditor);
    SyntaxEditor.TaggersRegistry.RegisterTagger(cSharpTagger);
}

 

This does not Show any result. The SyntaxEditor is initialized and editable. But the code from ShellViewModel.cs is not showing (it is correctly loaded in the reader). Also when I type keywords into the editor, they are not highlighted. The SyntaxEditor.Document.CurrentSnapshot also does show that at least something is loaded (correct lenght and linecount).

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 13 Dec 2019, 08:49 AM

Hello Johan,

Can you send us a sample app that we can investigate locally ? What is the Build Action of the ShellViewModel.cs ? Is there any Exception / VS output error while loading ?

Regards,
Petar Mladenov
Progress Telerik

Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Johan
Top achievements
Rank 1
answered on 13 Dec 2019, 09:14 AM

Hello Petar,

I wrote a stackoverflow post with more information.

There are indeed two errors:

System.Windows.Data Error: 1 : Cannot create default converter to perform 'two-way' conversions between types 'Telerik.Windows.Controls.RadSyntaxEditor' and 'System.Windows.Visibility'. Consider using Converter property of Binding. BindingExpression:Path=SyntaxEditor; DataItem='CodeEditorViewModel' (HashCode=16353430); target element is 'RadSyntaxEditor' (Name='SyntaxEditor'); target property is 'Visibility' (type 'Visibility')

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='Telerik.Windows.Controls.RadSyntaxEditor' BindingExpression:Path=SyntaxEditor; DataItem='CodeEditorViewModel' (HashCode=16353430); target element is 'RadSyntaxEditor' (Name='SyntaxEditor'); target property is 'Visibility' (type 'Visibility')

0
Accepted
Petar Mladenov
Telerik team
answered on 17 Dec 2019, 04:32 PM

Hello Johan,

I noticed you have marked the Martin's answer positively in stackoverflow. Could you please confirm all works fine at your side so we can close this thread ? Thank you in advance.

Regards,
Petar Mladenov
Progress Telerik

Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
SyntaxEditor
Asked by
Johan
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Johan
Top achievements
Rank 1
Share this question
or