Language
Edit

DataConsumerThemableBase<T>.GetObjectByThemeLookupIndex Method

Definition

Get a value within a binding profile using the theme key path at index n.

protected virtual T GetObjectByThemeLookupIndex(MixedReality.Toolkit.Data.DataConsumerThemableBase.BindingInfo binding, int n);
abstract member GetObjectByThemeLookupIndex : MixedReality.Toolkit.Data.DataConsumerThemableBase.BindingInfo * int -> 'T
override this.GetObjectByThemeLookupIndex : MixedReality.Toolkit.Data.DataConsumerThemableBase.BindingInfo * int -> 'T
Protected Overridable Function GetObjectByThemeLookupIndex (binding As DataConsumerThemableBase.BindingInfo, n As Integer) As T

Parameters

binding
DataConsumerThemableBase.BindingInfo

The binding to use when looking up the value at index n in the ValueToThemeKeypathLookup array.

n
Int32

Index for looking up an object of type T.

Returns

T

Found object of type T or null if not found.

Remarks

Override this method to support data sources that provide integral values that can be then used as an index lookup of the appropriate theme relative or absolute keypath. If not already present in the returned value, the keypath will be appended to the base keypath provided in the DataConsumerThemeHelper.

For example:

Given the stored value is an integer status where 0=new, 1=in progress and 2=done and it is desired to load a sprite for the correct status in the look and feel of the current theme.

The local lookup in the derived class can be structured as an absolute keypath as follows:

0 : Status.Sprites.New
1 : Status.Sprites.InProgress
2 : Status.Sprites.Done

This keypath returned from this method will be used to retrieve its value via the DataConsumerThemeHelper. Whatever value is stored in the matching field of the theme data source will then be used to autodetect the method of retrieving the final sprite and the sprite will be retrieved and returned.

Applies to