{"id":29724573,"url":"https://github.com/mastersign/mastersign.wpfcodeeditor","last_synced_at":"2026-03-01T19:02:07.349Z","repository":{"id":289845926,"uuid":"972580938","full_name":"mastersign/Mastersign.WpfCodeEditor","owner":"mastersign","description":"WPF control for editing JSON and YAML with syntax highlighting and JSON schema support","archived":false,"fork":false,"pushed_at":"2025-05-13T13:07:27.000Z","size":4348,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-12-05T22:36:46.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mastersign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-25T10:05:16.000Z","updated_at":"2025-11-21T06:54:33.000Z","dependencies_parsed_at":"2025-04-25T11:45:09.398Z","dependency_job_id":null,"html_url":"https://github.com/mastersign/Mastersign.WpfCodeEditor","commit_stats":null,"previous_names":["mastersign/mastersign.wpfcodeeditor"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mastersign/Mastersign.WpfCodeEditor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2FMastersign.WpfCodeEditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2FMastersign.WpfCodeEditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2FMastersign.WpfCodeEditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2FMastersign.WpfCodeEditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastersign","download_url":"https://codeload.github.com/mastersign/Mastersign.WpfCodeEditor/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastersign%2FMastersign.WpfCodeEditor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29980796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-24T21:22:00.899Z","updated_at":"2026-03-01T19:02:07.343Z","avatar_url":"https://github.com/mastersign.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mastersign WPF Code Editor Control\n\n![NuGet Version](https://img.shields.io/nuget/v/Mastersign.WpfCodeEditor)\n\n\u003e WPF control for editing JSON and YAML with syntax highlighting and JSON schema support\n\n![Demo Screenshot](screenshot.png)\n\n## Intention\n\nThis control is intended to be used as a powerful editor for\ndata structures in a WPF application.\nThe main goal is to provide a YAML and JSON editor with JSON schema support.\nWith this capability it is well suited for editing configuration files and data models.\n\nIt is supposed to support editing individual files without further context.\n\nIt is designed to run on modern Windows 11 systems without additional setup.\n\n## Background\n\nThe control makes use of the Monaco editor from Visual Studio Code,\nbundeled with the `monaco-yaml` plug-in.\nThe Monaco editor is rendered in WebView2.\nWhich is an embedded instance of a specially configured version of the Microsofts Edge browser.\n\nThis stack is optimized for the reuse of resources.\nWebView2 usually makes use of the Edge browser installed with Windows.\nAnd even if multiple instances of the Mastersign WPF Code Editor Control\nare displayed, in the background only one instance of the Edge browser engine is running.\nEvery instance of the Mastersign WPF Code Editor Control is comparable\nwith a tab in the Edge browser in regard to resource consumption.\n\n## Limitations\n\nEditing code for programming is not well supported.\nThis is due to the fact, that the control does not load a project context or fully featured language server.\nIt is focused on editing structural data files.\n\nThe control currently does not support property binding for the edited text.\nThat is due to the fact, that data exchange with Monaco is performed asynchronously.\n\n## Requirements\n\nThe control targets .NET Framework 4.8, which is installed by default\non Windows 10 and Windows 11.\n\nThe control makes use of WebView2 and expects the WebView2 runtime to be installed on the system.\nFor current Windows 11 systems, and even the most Windows 10 systems, this is given.\nOn older Windows 10 systems the WebView2 runtime can be installed manually.\n\n## Usage\n\nAdd the NuGet package `Mastersign.WpfCodeEditor` as a dependency to your WPF project.\n\nPut the XML namespace `xmlns:ce=\"clr-namespace:Mastersign.WpfCodeEditor;assembly=Mastersign.WpfCodeEditor\"` into your parent window or page.\n\nThen use `\u003cce:CodeEditor\u003e` to place the code editor in your XAML.\n\nYou can configure the editor with an instance of `CodeEditorConfiguration`.\nIf you decide to the change the `CodeEditor.Configuration` in the code behind file, it might be necessary to call `CodeEditor.Reinitialize()` to apply the changed configuration.\n\nUse the `CodeEditor.EditorReady` event to get notified\nwhen Monaco is loaded and initialized.\n\n```xml\n\u003cWindow x:Class=\"Demo.MainWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:ce=\"clr-namespace:Mastersign.WpfCodeEditor;assembly=Mastersign.WpfCodeEditor\"\n        Title=\"Mastersign WPF Code Editor Control Demo\"\n        Height=\"600\" Width=\"800\"\u003e\n\n    \u003cGrid\u003e\n        \u003cGrid.RowDefinitions\u003e\n            \u003cRowDefinition Height=\"Auto\" /\u003e\n            \u003cRowDefinition /\u003e\n        \u003c/Grid.RowDefinitions\u003e\n\n        \u003cButton x:Name=\"btnGetText\"\n                Click=\"btnGetText_Click\"\u003e\n            Get Text\n        \u003c/Button\u003e\n\n        \u003cce:CodeEditor x:Name=\"codeEditor\"\n                       EditorReady=\"codeEditor_Ready\"\u003e\n            \u003cce:CodeEditor.Configuration\u003e\n                \u003cce:CodeEditorConfiguration\n                    EnableSchemaRequests=\"True\"\n                    ShowBreadcrumbs=\"True\"\n                    ShowCodeMarkers=\"True\"\n                    CodeMarkersHeight=\"20vh\"\n                    LineNumbers=\"On\"\n                    VerticalScrollbar=\"Visible\"\n                    HorizontalScrollbar=\"Auto\"\n                    MinimapSide=\"Right\"\n                    MinimapAutohide=\"False\"\n                    MinimapShowSlider=\"Always\"\n                    /\u003e\n            \u003c/ce:CodeEditor.Configuration\u003e\n        \u003c/ce:CodeEditor\u003e\n    \u003c/Grid\u003e\n\u003c/Window\u003e\n```\n\nTo load a custom JSON schema, use the asynchronous method\n`CodeEditor.LoadJsonSchemaAsync(string schema, string uri)`.\n\nTo load your code into the editor, use the asynchronous method\n`CodeEditor.LoadText(string text, CodeLanguage language, string filename)`.\nThe language is used by Monaco to activate syntax highlighting and schema validation.\nThe filename is considered by the schema validator to\nautomatically select a JSON schema.\nE.g. the NodeJS package definition schema for `package.json`.\n\nTo retrieve the currently edited text from the editor control,\nuse the asynchronous method `CodeEditor.GetTextAsync()`.\n\nThese methods are asynchronous, because WebView2 is using\ninter-process communication in the background,\nto exchange data with the Edge browser process, rendering Monaco.\n\n```cs\nusing System;\nusing System.Windows;\n\nnamespace Demo;\n\npublic partial class MainWindow : Window\n{\n    public MainWindow()\n    {\n        InitializeComponent();\n    }\n\n    private async void codeEditor_Ready(object sender, EventArgs e)\n    {\n        await codeEditor.LoadJsonSchemaAsync(\n            \"\"\"\n            {\n              \"$id\": \"https://example.com/address.schema.json\",\n              \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n              \"description\": \"An address similar to http://microformats.org/wiki/h-card\",\n              \"type\": \"object\",\n              \"properties\": {\n                \"postOfficeBox\": { \"type\": \"string\" },\n                \"extendedAddress\": { \"type\": \"string\" },\n                \"streetAddress\": { \"type\": \"string\" },\n                \"locality\": { \"type\": \"string\" },\n                \"region\": { \"type\": \"string\" },\n                \"postalCode\": { \"type\": \"string\" },\n                \"countryName\": { \"type\": \"string\" }\n              },\n              \"required\": [ \"locality\", \"region\", \"countryName\" ],\n              \"dependentRequired\": {\n                \"postOfficeBox\": [ \"streetAddress\" ],\n                \"extendedAddress\": [ \"streetAddress\" ]\n              }\n            }\n            \"\"\",\n            // This is an URI not a URL.\n            // The code editor extracts the schema name 'address.schema.json' from the URI,\n            // but does not try to fetch a resource from the URI.\n            \"https://example.com/address.schema.json\");\n\n        await codeEditor.LoadTextAsync(\n            \"\"\"\n            {\n              \"postOfficeBox\": \"123\",\n              \"streetAddress\": \"456 Main St\",\n              \"locality\": \"Cityville\",\n              \"region\": \"State\",\n              \"postalCode\": \"12345\",\n              \"countryName\": \"Country\"\n            }\n            \"\"\",\n            \"json\", \"address.json\");\n    }\n\n    private async void btnGetText_Click(object sender, EventArgs e)\n    {\n        var text = await codeEditor.GetTextAsync();\n        MessageBox.Show(text);\n    }\n}\n```\n\n## License\n\nThis project is published under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastersign%2Fmastersign.wpfcodeeditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastersign%2Fmastersign.wpfcodeeditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastersign%2Fmastersign.wpfcodeeditor/lists"}