Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.Extensions Class Reference

Visual-tree ancestor lookup and sample placeholder construction utilities. More...

Static Public Member Functions

static VisualElement GetDocumentRoot (this VisualElement ele)
 Walks up the VisualTree to find the top most VisualElement of the panel that the given element belongs to.
static VisualElement SlotSimulator (int slotCount)
 Creates a container with a given number of 'Slots' to simulate a grid layout.

Detailed Description

Visual-tree ancestor lookup and sample placeholder construction utilities.

These helpers do not establish controller ownership, persistence or inventory logic.

Member Function Documentation

◆ GetDocumentRoot()

VisualElement GWG.WindowFramework.Extensions.GetDocumentRoot ( this VisualElement ele)
inlinestatic

Walks up the VisualTree to find the top most VisualElement of the panel that the given element belongs to.

Parameters
eleThe Visual Element to use as a stating point
Returns
The top most VisualElement in the panel hierarchy
Exceptions
ArgumentNullExceptionThrown if the given element is null

// Get the root element of the panel that contains the given element

VisualElement rootElement = Extensions.GetDocumentRoot(someVisualElement);
Visual-tree ancestor lookup and sample placeholder construction utilities.
Definition Extensions.cs:10
static VisualElement GetDocumentRoot(this VisualElement ele)
Walks up the VisualTree to find the top most VisualElement of the panel that the given element belong...
Definition Extensions.cs:27

Returns the topmost current ancestor even for a detached subtree. It does not query UIDocument ownership or guarantee the controller's managed window root. Use the configured controller root for managed window hosting, not this utility's result blindly.

◆ SlotSimulator()

VisualElement GWG.WindowFramework.Extensions.SlotSimulator ( int slotCount)
inlinestatic

Creates a container with a given number of 'Slots' to simulate a grid layout.

Parameters
slotCountNumber of 'Slots' to create in the grid
Returns
The container with the simulated grid layout

// Create a container with 10 slots to simulate a 5x5 grid layout

VisualElement slotContainer = Extensions.SlotSimulator(10);
static VisualElement SlotSimulator(int slotCount)
Creates a container with a given number of 'Slots' to simulate a grid layout.
Definition Extensions.cs:49

Creates slotCount empty 50-by-50 placeholder elements with inline gray/white styling in a wrapping row. This is a visual demonstrator, not an inventory/grid data API, fixed column count, theme-tokenized production control or interaction implementation. Zero/negative counts produce an empty container. No item data or resources are loaded.

Here is the caller graph for this function: