Window Framework v1.2.4
Window Framework for Unity UI Toolkit
Loading...
Searching...
No Matches
GWG.WindowFramework.Extensions Class Reference

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.

Member Function Documentation

◆ GetDocumentRoot()

VisualElement GWG.WindowFramework.Extensions.GetDocumentRoot ( this VisualElement ele)
static
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);
Definition Extensions.cs:8
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:22

◆ SlotSimulator()

VisualElement GWG.WindowFramework.Extensions.SlotSimulator ( int slotCount)
static
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:40