You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/index.md
+19-15Lines changed: 19 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,40 @@
1
+
---
2
+
title: Home
3
+
---
4
+
5
+
# NanoByte Structure Editor
6
+
1
7
NanoByte Structure Editor is a WinForms library that helps you build split-screen editors for your data structures, consisting of:
2
8
3
9
1. a collapsible tree-view of the data structure,
4
-
2. a graphical editor for the currently selected node in the tree (`PropertyGrid` or custom) and
10
+
2. a graphical editor for the currently selected node in the tree (<xref:System.Windows.Forms.PropertyGrid> or custom) and
5
11
3. a text editor (based on [ICSharpCode.TextEditor](https://github.com/nano-byte/ICSharpCode.TextEditor)) with a serialized (XML) representation of the currently selected node.
6
12
7
13
This allows you to create an IDE-like experience for your users when editing complex domain specific languages, configuration files, etc..
Add a reference to the [NanoByte.StructureEditor.WinForms](https://www.nuget.org/packages/NanoByte.StructureEditor.WinForms/) NuGet package to your project. It is available for .NET Framework 2.0+.
16
20
17
21
### Initialization
18
22
19
-
Create an instance of \ref NanoByte.StructureEditor.WinForms.StructureEditor "StructureEditor<T>" and add it to your Form:
20
-
```{.cs}
23
+
Create an instance of <xref:NanoByte.StructureEditor.WinForms.StructureEditor`1> and add it to your Form:
24
+
```csharp
21
25
vareditor=newStructureEditor<MyData>();
22
26
Controls.Add(editor);
23
27
```
24
28
25
-
Alternatively, you may want to derive your own class from \ref NanoByte.StructureEditor.WinForms.StructureEditor "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.
26
-
```{.cs}
29
+
Alternatively, you may want to derive your own class from <xref:NanoByte.StructureEditor.WinForms.StructureEditor`1>. 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.
30
+
```csharp
27
31
publicclassMyDataEditor : StructureEditor<MyData>
28
32
{}
29
33
```
30
34
31
35
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.
32
-
- Call \ref NanoByte.StructureEditor.IStructureEditor.DescribeRoot "DescribeRoot()" and then use the fluent API provided as a return value to describe the properties on your main data type.
33
-
- Call \ref NanoByte.StructureEditor.IStructureEditor.Describe<TContainer> "Describe<TContainer>()" to describe the properties on a data type `TContainer` exposed by another property. You can use multiple calls with different type parameters to describe arbitrarily deep hierarchies.
36
+
- Call [DescribeRoot()](xref:NanoByte.StructureEditor.IStructureEditor`1#NanoByte_StructureEditor_IStructureEditor_1_DescribeRoot_System_String_) and then use the fluent API provided as a return value to describe the properties on your main data type.
37
+
- Call [Describe<TContainer>()](xref:NanoByte.StructureEditor.IStructureEditor`1#NanoByte_StructureEditor_IStructureEditor_1_Describe__1) to describe the properties on a data type `TContainer` exposed by another property. You can use multiple calls with different type parameters to describe arbitrarily deep hierarchies.
34
38
35
39
The fluent API provides the following methods:
36
40
-`.AddProperty()` describes a simple value property.
@@ -39,7 +43,7 @@ The fluent API provides the following methods:
39
43
40
44
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.
41
45
42
-
```{.cs}
46
+
```csharp
43
47
editor.DescribeRoot("Address Book")
44
48
.AddPlainList("Group", x=>x.Groups);
45
49
editor.Describe<IContactContainer>()
@@ -54,13 +58,13 @@ editor.Describe<Contact>()
54
58
55
59
### Storage
56
60
57
-
Use the \ref NanoByte.StructureEditor.WinForms.StructureEditor.Open "Open()" method to load an XML file into the editor:
58
-
```{.cs}
61
+
Use the [Open()](xref:NanoByte.StructureEditor.WinForms.StructureEditor`1#NanoByte_StructureEditor_WinForms_StructureEditor_1_Open_NanoByte_Common_Undo_ICommandManager__0__) method to load an XML file into the editor:
Use the \ref NanoByte.Common.Undo.ICommandManager.Save "Save()" method on the \ref NanoByte.StructureEditor.WinForms.StructureEditor.CommandManager "CommandManager" property to save the editor's content as an XML file:
63
-
```{.cs}
66
+
Use the [Save()](xref:NanoByte.Common.Undo.ICommandManager`1#NanoByte_Common_Undo_ICommandManager_1_Save_System_String_) method on the [CommandManager](xref:NanoByte.StructureEditor.WinForms.StructureEditor`1#NanoByte_StructureEditor_WinForms_StructureEditor_1_CommandManager) property to save the editor's content as an XML file:
0 commit comments