DataUiGrid
Introduction
The DataUiGrid is similar to the Windows Forms PropertyGrid: a reflection-based control which displays the properties on an object in real time. It can also display properties through explicit get and set methods rather than reflection. Gum uses it for the Variables tab, but it is general purpose and can be used in any Avalonia application.
The grid is split into two projects in the Gum repository:
DataUi.Coreholds the data model (MemberCategory,InstanceMember, and theIDataUiinterface). It has no UI framework dependency.AvaloniaDataUiholds the AvaloniaDataUiGridcontrol and its editors.
The DataUiGrid can be used with reflection or its Categories can be manually populated. Using reflection is easier to set up, but does not provide as much flexibility. Manually building up Categories takes more work, but provides the most flexibility.
Adding References
Add a project reference to AvaloniaDataUi/AvaloniaDataUi.csproj. It brings DataUi.Core with it.
Adding a DataUiGrid in Code
Construct a grid in code like any other Avalonia control:
// Initialize
var grid = new AvaloniaDataUi.DataUiGrid();
// add the grid to a layout control such as a Grid or StackPanel...Using the grid in code
To use the grid, set its Instance property to the object you want to view. For example:
The grid displays one row for each public property on the object, grouped into categories.
Last updated
Was this helpful?

