Document not Showing

4 posts, 1 answers
  1. Johan
    Johan avatar
    2 posts
    Member since:
    Dec 2011

    Posted 11 Dec 2019 Link to this post

    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).

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3119 posts

    Posted 13 Dec 2019 Link to this post

    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.
  3. Johan
    Johan avatar
    2 posts
    Member since:
    Dec 2011

    Posted 13 Dec 2019 in reply to Petar Mladenov Link to this post

    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')

  4. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    3119 posts

    Posted 17 Dec 2019 Link to this post

    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.
Back to Top