mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Tidied up docs and fixed several methods to be virtual
This commit is contained in:
@@ -35,35 +35,24 @@ Having to create a bunch of TreeNode objects can be a pain especially if you alr
|
||||
```csharp
|
||||
// Your data class
|
||||
private class House : TreeNode {
|
||||
|
||||
|
||||
|
||||
// Your properties
|
||||
public string Address {get;set;}
|
||||
public List<Room> Rooms {get;set;}
|
||||
|
||||
// ITreeNode member:
|
||||
public override IList<ITreeNode> Children => Rooms.Cast<ITreeNode>().ToList();
|
||||
|
||||
public IList<ITreeNode> Children => Rooms.Cast<ITreeNode>().ToList();
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return Address;
|
||||
}
|
||||
public override string Text { get => Address; set => Address = value; }
|
||||
}
|
||||
|
||||
|
||||
// Your other data class
|
||||
private class Room : TreeNode{
|
||||
|
||||
|
||||
public string Name {get;set;}
|
||||
|
||||
|
||||
// Rooms have no sub objects
|
||||
public IList<ITreeNode> Children => new List<ITreeNode>();
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
public override string Text{get=>Name;set{Name=value;}}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user