Item ViewModel
The Item ViewModel acts as the primary data entry point for individual item widgets.
It wraps either a full Item Instance (managed by the inventory system) or a lightweight Item View (used for detached or preview representations such as selected loot), providing a unified interface for UI consumption.
This ViewModel is commonly used in ViewModel Extensions, allowing container-based widgets (e.g., Lists, Grids) to dynamically inject item data into their entry widgets.
Configuration
The Item ViewModel is typically instantiated by a Container ViewModel using a ViewModel Extension. In this flow:
The container provides the configured
Item ViewModelfor each item entry.The UI list or box widget creates an instance of your Item Widget.
The extension automatically assigns the
Item ViewModelto the widget.From there, the
Item ViewModelpropagates data to any bound Fragment ViewModels or UI functions.
For this reason, the Creation Type of the Item ViewModel should always be set to Manual, as it is injected externally rather than constructed by the widget itself.
No custom setter functions are required for this process to work, the ViewModel system handles the data flow automatically.
Notifies
The following ViewModel functions are exposed and can be bound to in the UI:
Field | Type | Description |
|---|---|---|
| Function | Returns |
| Function | Returns |
| Function | Returns the currently assigned |
| Function | Returns the currently assigned |