DataToResource Class
Binds to a resource with the key provided in a context variable. This allows selecting resources from JavaScript by key name.
In this example three different fonts are created as resources. The font is selected by name in the exported JavaScript items.
<Font File="../../Assets/fonts/Roboto-Bold.ttf" ux:Key="Bold"/>
<Font File="../../Assets/fonts/Roboto-Regular.ttf" ux:Key="Regular"/>
<Font File="../../Assets/fonts/Roboto-Italic.ttf" ux:Key="Italic"/>
<JavaScript>
exports.items = [
{ font: "Bold" },
{ font: "Regular" },
{ font: "Italic" },
]
</JavaScript>
<StackPanel>
<Each Items="{items}">
<Text Value="Sample Text" Font="{DataToResource font}"/>
</Each>
</StackPanel>
{DataToResource variableKey}
is similar to {Resource key}
, except it allows a variable key name instead of a static one.
Location
- Namespace
- Fuse.Reactive
- Package
- Fuse.Reactive.Expressions 2.9.1
Interface of DataToResource
Inherited from Expression
SourceFileName : string ux
hide
SourceLineNumber : int ux
hide
Subscribe(IContext, IListener) : IDisposable uno
See IExpression.Subscribe
for docs.
Inherited from object
Equals(object) : bool uno
GetHashCode : int uno
GetType : Type uno
ToString : string uno
Attached UX Attributes
GlobalKey (attached by Resource) : string ux
Implemented Interfaces
IExpression uno
ISourceLocation uno
hide