UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
Loading...
Searching...
No Matches
GWG.UsoUIElements.UsoListView Class Reference

A custom list view control that extends Unity's ListView with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system. More...

Inheritance diagram for GWG.UsoUIElements.UsoListView:

Public Member Functions

 UsoListView ()
 Initializes a new instance of the UsoListView class with default settings. Creates a list view with USO framework integration and comprehensive default configuration.
 UsoListView (string fieldName)
 Initializes a new instance of the UsoListView class with the specified field name. Creates a list view with custom identification for binding and reference purposes.
 UsoListView (string fieldName, out UsoListView newField)
 Initializes a new instance of the UsoListView class with field name and returns a reference. Creates a list view with custom identification and provides an out parameter for immediate access.
 UsoListView (string fieldName, string fieldBindingPath, BindingMode fieldBindingMode)
 Initializes a new instance of the UsoListView class with field name and data binding configuration. Creates a list view with custom identification and automatic data binding for collection synchronization.
 UsoListView (string fieldName, string fieldBindingPath, BindingMode fieldBindingMode, out UsoListView newField)
 Initializes a new instance of the UsoListView class with field name, data binding, and returns a reference. Creates a list view with custom identification, automatic data binding, and provides an out parameter for immediate access.
 UsoListView (string fieldName, string headerText, string fieldBindingPath, BindingMode fieldBindingMode)
 Initializes a new instance of the UsoListView class with field name, header text, and data binding. Creates a fully configured list view with custom identification, header title, and automatic data binding.
 UsoListView (string fieldName, string headerText, string fieldBindingPath, BindingMode fieldBindingMode, out UsoListView newField)
 Initializes a new instance of the UsoListView class with complete configuration and returns a reference. Creates a fully configured list view with custom identification, header title, automatic data binding, and immediate access to the created instance.
void ApplyBinding (string fieldBindingProp, string fieldBindingPath, BindingMode fieldBindingMode)
 Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.
UsoLineItem GetParentLineItem ()
 Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.
void InitElement (string fieldName=null)
 Initializes the USO UI element with the specified field name and applies comprehensive default configuration. This method sets up the basic USO framework integration and configures all list view properties for optimal user experience.
virtual VisualElement MakeFooter (string labelText)
 Creates a visual element to use as a list view footer with the specified label text. This virtual method can be overridden to customize the footer appearance and layout.
virtual VisualElement MakeHeader (string labelText)
 Creates a visual element to use as a list view header with the specified label text. This virtual method can be overridden to customize the header appearance and layout.
virtual VisualElement MakeNoneElement ()
 Creates a visual element to display when the list view has no data items. This virtual method can be overridden to customize the empty state appearance and messaging.
void SetFieldStatus (FieldStatusTypes fieldStatus)
 Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.
void ShowFieldStatus (bool status)
 Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.
Public Member Functions inherited from GWG.UsoUIElements.IUsoUiElement
void AddToClassList (string className)
 Adds the specified CSS class name to this element's class list. This method is inherited from Unity's VisualElement and enables dynamic styling modifications.
void ClearBindings ()
 Removes all data binding configurations from this element. This method is inherited from Unity's VisualElement and provides cleanup functionality for data bindings.
void RemoveFromClassList (string className)
 Removes the specified CSS class name from this element's class list. This method is inherited from Unity's VisualElement and provides dynamic styling capabilities.

Properties

FieldStatusTypes FieldStatus [get, private set]
 Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.
bool FieldStatusEnabled [get, private set]
 Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.

Private Attributes

FieldStatusTypes _fieldStatus
bool _fieldStatusEnabled = true

Static Private Attributes

const string DefaultBindProp = "itemsSource"
 Default binding property used when applying data bindings to this field. Binds to the 'itemsSource' property which controls the collection data displayed in the list.
const string ElementClass = "uso-list-view"
 CSS class name applied to all UsoListView instances for styling purposes.
const string ElementValidationClass = "uso-field-validation"
 CSS class name applied when field validation/status functionality is enabled.

Detailed Description

A custom list view control that extends Unity's ListView with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system.

This control implements the IUsoUiElement interface to provide consistent behavior across the USO UI framework. It supports field status indicators, automatic data binding for collection sources, and custom styling through CSS classes. The control is pre-configured with common list view settings including dynamic height virtualization, add/remove functionality, reordering capabilities, alternating row backgrounds, and comprehensive user interaction features. It also provides virtual methods for customizing header, footer, and empty state elements.

Constructor & Destructor Documentation

◆ UsoListView() [1/7]

GWG.UsoUIElements.UsoListView.UsoListView ( )

Initializes a new instance of the UsoListView class with default settings. Creates a list view with USO framework integration and comprehensive default configuration.

◆ UsoListView() [2/7]

GWG.UsoUIElements.UsoListView.UsoListView ( string fieldName)

Initializes a new instance of the UsoListView class with the specified field name. Creates a list view with custom identification for binding and reference purposes.

Parameters
fieldNameThe name to assign to this list view element.

◆ UsoListView() [3/7]

GWG.UsoUIElements.UsoListView.UsoListView ( string fieldName,
out UsoListView newField )

Initializes a new instance of the UsoListView class with field name and returns a reference. Creates a list view with custom identification and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this list view element.
newFieldOutput parameter that receives a reference to the newly created list view.

◆ UsoListView() [4/7]

GWG.UsoUIElements.UsoListView.UsoListView ( string fieldName,
string fieldBindingPath,
BindingMode fieldBindingMode )

Initializes a new instance of the UsoListView class with field name and data binding configuration. Creates a list view with custom identification and automatic data binding for collection synchronization.

Parameters
fieldNameThe name to assign to this list view element.
fieldBindingPathThe path to the data source collection property for automatic binding.
fieldBindingModeThe binding mode that controls data flow between source and target.

◆ UsoListView() [5/7]

GWG.UsoUIElements.UsoListView.UsoListView ( string fieldName,
string fieldBindingPath,
BindingMode fieldBindingMode,
out UsoListView newField )

Initializes a new instance of the UsoListView class with field name, data binding, and returns a reference. Creates a list view with custom identification, automatic data binding, and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this list view element.
fieldBindingPathThe path to the data source collection property for automatic binding.
fieldBindingModeThe binding mode that controls data flow between source and target.
newFieldOutput parameter that receives a reference to the newly created list view.

◆ UsoListView() [6/7]

GWG.UsoUIElements.UsoListView.UsoListView ( string fieldName,
string headerText,
string fieldBindingPath,
BindingMode fieldBindingMode )

Initializes a new instance of the UsoListView class with field name, header text, and data binding. Creates a fully configured list view with custom identification, header title, and automatic data binding.

Parameters
fieldNameThe name to assign to this list view element.
headerTextThe text to display in the list view header.
fieldBindingPathThe path to the data source collection property for automatic binding.
fieldBindingModeThe binding mode that controls data flow between source and target.

◆ UsoListView() [7/7]

GWG.UsoUIElements.UsoListView.UsoListView ( string fieldName,
string headerText,
string fieldBindingPath,
BindingMode fieldBindingMode,
out UsoListView newField )

Initializes a new instance of the UsoListView class with complete configuration and returns a reference. Creates a fully configured list view with custom identification, header title, automatic data binding, and immediate access to the created instance.

Parameters
fieldNameThe name to assign to this list view element.
headerTextThe text to display in the list view header.
fieldBindingPathThe path to the data source collection property for automatic binding.
fieldBindingModeThe binding mode that controls data flow between source and target.
newFieldOutput parameter that receives a reference to the newly created list view.

Member Function Documentation

◆ ApplyBinding()

void GWG.UsoUIElements.UsoListView.ApplyBinding ( string fieldBindingProp,
string fieldBindingPath,
BindingMode fieldBindingMode )

Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.

Parameters
fieldBindingPropThe property name on this control to bind to.
fieldBindingPathThe path to the data source property to bind from.
fieldBindingModeThe binding mode that determines how data flows between source and target.
Exceptions
ExceptionThrown when binding setup fails. Original exception is preserved and re-thrown.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ GetParentLineItem()

UsoLineItem GWG.UsoUIElements.UsoListView.GetParentLineItem ( )

Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.

Returns
The parent UsoLineItem if found; otherwise, null.

◆ InitElement()

void GWG.UsoUIElements.UsoListView.InitElement ( string fieldName = null)

Initializes the USO UI element with the specified field name and applies comprehensive default configuration. This method sets up the basic USO framework integration and configures all list view properties for optimal user experience.

Parameters
fieldNameOptional name to assign to the element. If null, no name is set.

Default configuration includes:

  • Dynamic height virtualization for performance
  • Collection size display and add/remove functionality
  • Foldout header and footer visibility
  • Animated reordering with single selection
  • Alternating row backgrounds and horizontal scrolling
  • Flexible layout with grow/shrink properties
  • Custom empty state element factory

Implements GWG.UsoUIElements.IUsoUiElement.

◆ MakeFooter()

virtual VisualElement GWG.UsoUIElements.UsoListView.MakeFooter ( string labelText)
virtual

Creates a visual element to use as a list view footer with the specified label text. This virtual method can be overridden to customize the footer appearance and layout.

Parameters
labelTextThe text content to display in the footer element.
Returns
A VisualElement configured as a footer, typically a Label with subtitle styling.

The default implementation creates a Label with the "uso-label--subtitle" CSS class for consistent subtitle-level styling throughout the application.

◆ MakeHeader()

virtual VisualElement GWG.UsoUIElements.UsoListView.MakeHeader ( string labelText)
virtual

Creates a visual element to use as a list view header with the specified label text. This virtual method can be overridden to customize the header appearance and layout.

Parameters
labelTextThe text content to display in the header element.
Returns
A VisualElement configured as a header, typically a Label with title styling.

The default implementation creates a Label with the "uso-label--title" CSS class for consistent title-level styling throughout the application.

◆ MakeNoneElement()

virtual VisualElement GWG.UsoUIElements.UsoListView.MakeNoneElement ( )
virtual

Creates a visual element to display when the list view has no data items. This virtual method can be overridden to customize the empty state appearance and messaging.

Returns
A VisualElement containing the empty state UI, typically including informational text and styling.

The default implementation creates a UsoVisualElement with a HelpBox containing user guidance about using the Add button to create new items. The element includes the "uso-list-view__no-data" CSS class for styling.

◆ SetFieldStatus()

void GWG.UsoUIElements.UsoListView.SetFieldStatus ( FieldStatusTypes fieldStatus)

Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.

Parameters
fieldStatusThe new field status type to apply.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ ShowFieldStatus()

void GWG.UsoUIElements.UsoListView.ShowFieldStatus ( bool status)

Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.

Parameters
statusTrue to enable field status functionality; false to disable it.

Implements GWG.UsoUIElements.IUsoUiElement.

Member Data Documentation

◆ _fieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoListView._fieldStatus
private

◆ _fieldStatusEnabled

bool GWG.UsoUIElements.UsoListView._fieldStatusEnabled = true
private

◆ DefaultBindProp

const string GWG.UsoUIElements.UsoListView.DefaultBindProp = "itemsSource"
staticprivate

Default binding property used when applying data bindings to this field. Binds to the 'itemsSource' property which controls the collection data displayed in the list.

◆ ElementClass

const string GWG.UsoUIElements.UsoListView.ElementClass = "uso-list-view"
staticprivate

CSS class name applied to all UsoListView instances for styling purposes.

◆ ElementValidationClass

const string GWG.UsoUIElements.UsoListView.ElementValidationClass = "uso-field-validation"
staticprivate

CSS class name applied when field validation/status functionality is enabled.

Property Documentation

◆ FieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoListView.FieldStatus
getprivate set

Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.

The current FieldStatusTypes value indicating the field's validation state.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ FieldStatusEnabled

bool GWG.UsoUIElements.UsoListView.FieldStatusEnabled
getprivate set

Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.

True if field status functionality is enabled; otherwise, false. Default is true.

Implements GWG.UsoUIElements.IUsoUiElement.