NanoByte.StructureEditor
0.8.0
See the version list below for details.
dotnet add package NanoByte.StructureEditor --version 0.8.0
NuGet\Install-Package NanoByte.StructureEditor -Version 0.8.0
<PackageReference Include="NanoByte.StructureEditor" Version="0.8.0" />
paket add NanoByte.StructureEditor --version 0.8.0
#r "nuget: NanoByte.StructureEditor, 0.8.0"
// Install NanoByte.StructureEditor as a Cake Addin #addin nuget:?package=NanoByte.StructureEditor&version=0.8.0 // Install NanoByte.StructureEditor as a Cake Tool #tool nuget:?package=NanoByte.StructureEditor&version=0.8.0
NanoByte Structure Editor
NanoByte Structure Editor is a WinForms library that helps you build split-screen editors for your data structures, consisting of:
- a collapsible tree-view of the data structure,
- a graphical editor for the currently selected node in the tree (
PropertyGrid
or custom) and - a text editor (based on ICSharpCode.TextEditor) with a serialized (XML) representation of the currently selected node.
This allows you to create an IDE-like experience for your users when editing complex domain specific languages, configuration files, etc..
Usage
Add a reference to the NanoByte.StructureEditor.WinForms NuGet package to your project. It is available for .NET Framework 2.0+ and .NET 6.0+.
Initialization
Create an instance of StructureEditor<T>
and add it to your Form:
var editor = new StructureEditor<MyData>();
Controls.Add(editor);
Alternatively, you may want to derive your own class from StructureEditor<T>
. This will allow you to use the graphical WinForms designer in Visual Studio (which does not support generic types) to place the Editor on your Form.
public class MyDataEditor : StructureEditor<MyData>
{}
You need to "describe" your data structure to the Editor. You can do this directly after instantiating the editor or in the constructor of your derived class.
- Call
DescribeRoot()
and then use the fluent API provided as a return value to describe the properties on your main data type. - Call
Describe<TContainer>()
to describe the properties on a data typeTContainer
exposed by another property. You can use multiple calls with different type parameters to describe arbitrarily deep hierarchies.
The fluent API provides the following methods:
.AddProperty()
describes a simple value property..AddPlainList()
describes a non-polymorphic list..AddList()
describes a polymorphic list. After calling it you need to chain.AddElement()
calls for each specific type of element the list can hold.
There are numerous overloads for each of these methods, e.g., allowing you to specify a custom editor control for a data type or to keep the auto-generated one.
editor.DescribeRoot("Address Book")
.AddPlainList("Group", x => x.Groups);
editor.Describe<IContactContainer>()
.AddPlainList("Contact", x => x.Contacts);
editor.Describe<Contact>()
.AddProperty("Home Address", x => PropertyPointer.For(() => x.HomeAddress))
.AddProperty("Work Address", x => PropertyPointer.For(() => x.WorkAddress))
.AddList(x => x.PhoneNumbers)
.AddElement("Landline Number", new LandlineNumber())
.AddElement("Mobile Number", new MobileNumber());
Storage
Use the Open()
method to load an XML file into the editor:
editor.Open(CommandManager<AddressBook>.Load(path));
Use the Save()
method on the CommandManager
property to save the editor's content as an XML file:
editor.CommandManager.Save(path);
Take a look a the sample project for a more complete setup, including undo/redo functionality.
Building
The source code is in src/
, config for building the API documentation is in doc/
and generated build artifacts are placed in artifacts/
. The source code does not contain version numbers. Instead the version is determined during CI using GitVersion.
To build install Visual Studio 2022 or newer and run .\build.ps1
.
Contributing
We welcome contributions to this project such as bug reports, recommendations and pull requests.
This repository contains an EditorConfig file. Please make sure to use an editor that supports it to ensure consistent code style, file encoding, etc.. For full tooling support for all style and naming conventions consider using JetBrains' ReSharper or Rider products.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.5
- NanoByte.Common (>= 2.18.0)
-
net6.0
- NanoByte.Common (>= 2.18.0)
-
net8.0
- NanoByte.Common (>= 2.18.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NanoByte.StructureEditor:
Package | Downloads |
---|---|
NanoByte.StructureEditor.WinForms
WinForms controls for building split-screen editors for data structures |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.8.3 | 85 | 10/28/2024 |
0.8.2 | 317 | 3/10/2024 |
0.8.1 | 282 | 2/29/2024 |
0.8.0 | 369 | 1/13/2024 |
0.7.7 | 541 | 9/30/2023 |
0.7.6 | 546 | 7/8/2023 |
0.7.5 | 508 | 6/26/2023 |
0.7.4 | 520 | 5/24/2023 |
0.7.3 | 579 | 4/9/2023 |
0.7.2 | 656 | 2/21/2023 |
0.7.1 | 659 | 1/30/2023 |
0.7.0 | 687 | 1/30/2023 |
0.6.1 | 641 | 1/30/2023 |
0.6.0 | 695 | 11/28/2022 |
0.5.10 | 731 | 10/16/2022 |
0.5.9 | 729 | 10/16/2022 |
0.5.8 | 736 | 9/20/2022 |
0.5.7 | 736 | 9/5/2022 |
0.5.6 | 780 | 7/20/2022 |
0.5.5 | 798 | 6/12/2022 |
0.5.4 | 783 | 5/18/2022 |
0.5.3 | 765 | 4/4/2022 |
0.5.2 | 858 | 2/24/2022 |
0.5.1 | 810 | 1/21/2022 |
0.5.0 | 689 | 12/6/2021 |
0.4.15 | 1,337 | 11/29/2021 |
0.4.14 | 695 | 10/18/2021 |
0.4.13 | 716 | 9/13/2021 |
0.4.12 | 731 | 8/28/2021 |
0.4.11 | 682 | 8/27/2021 |
0.4.10 | 710 | 5/5/2021 |
0.4.9 | 710 | 4/22/2021 |
0.4.8 | 694 | 4/19/2021 |
0.4.7 | 711 | 3/20/2021 |
0.4.6 | 751 | 3/9/2021 |
0.4.5 | 708 | 3/9/2021 |
0.4.4 | 744 | 3/9/2021 |
0.4.3 | 767 | 2/7/2021 |
0.4.2 | 827 | 1/24/2021 |
0.4.1 | 905 | 11/30/2020 |
0.4.0 | 862 | 11/21/2020 |
0.3.3 | 984 | 10/1/2020 |
0.3.2 | 1,018 | 7/19/2020 |
0.3.1 | 1,038 | 5/24/2020 |
0.3.0 | 1,054 | 1/8/2020 |
0.2.3 | 933 | 10/17/2019 |
0.2.2 | 905 | 7/25/2019 |
0.2.1 | 964 | 5/20/2019 |
0.2.0 | 960 | 4/2/2019 |
0.1.0 | 1,089 | 2/4/2019 |