Vixen
02b45cc4
csharp
public sealed class PropertyGrid

An inspector: editors generated from what a type says about itself.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Built on Vixen.Core.Reflection, which is generated rather than reflective. A MemberDescriptor's accessors are lambdas over a cast — static instance => ((Foo) instance).X — so this reads and writes arbitrary members after trimming and on iOS, which an inspector built on PropertyInfo.GetValue cannot. It is the same bet doc 11 makes for the editor's inspector, one layer down.

Several targets at once, which is what an inspector is for. Selecting twenty objects and setting one field on all of them is the operation; showing the first one's values and silently editing only that is the bug. Where the targets disagree the editor says so — an indeterminate checkbox, an empty field — and typing into it writes the new value to every one of them.

⚠ A struct member of a struct member cannot be written back. The accessors pass values as Object, so editing a nested value type edits a box that nothing holds. Nested reference types work, and nested structs are shown read-only rather than accepting edits that would vanish. Closing it needs ref accessors, which is a change to the descriptor rather than to this.

Fields and properties (7)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public SearchBox Search

    The search box above the rows.

  • public UiElement Body

    Where the rows go.

  • public IReadOnlyList<object> Targets

    What is being inspected.

  • public IReadOnlyList<PropertyRow> Rows

    The rows, in order.

  • public TypeDescriptor? Descriptor

    The type every target has in common, if they have one.

Events (1)

Methods (4)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public void Inspect(params ReadOnlySpan<object> objects)

    Shows the members of some objects.

  • public void Clear()

    Shows nothing.

  • public void Reload()

    Reads every editor back from the objects, without rebuilding anything.

Used by (3)

  • ShellHelloUi
  • NestedMemberTestsVixen.Ui.Controls.Advanced.Tests
  • PropertyGridTestsVixen.Ui.Controls.Advanced.Tests