UXML Runtime binding questions

Hello There,

I’m using the new runtime binding system in a project and this works really well for the moment.
Coming from a WPF background, I have some naturally occuring questions.

  • Is there any equivalent of “ConverterParameter” when using Converters ?
    I checked the definition of DataBinding and it seems there is nothing for it.

  • Is it possible to do things like “RelativeSource” bindings allowing to bind some properties of the front together ?

  • When using WPF you can use a thing called implicit DataTemplate to allow for example Instiating different UIs based on the type of the real type of the model for example
    The syntax looks something like this

<DataTemplate DataType="{Type1}">
<MyWonderfulUIComponent/>
</DataTemplate>
<DataTemplate DataType="{Type2}">
<AnotherOneJustAsGoodUIComponent/>
</DataTemplate>

This is super practial to define it on the XML side and works for instantiating different controls in a list for example.
In unity this is achievable with a converter I think but it would be great to allow defining it in the XML.

Thank you !

Hi @SebMaire !

We do not have this feature. However, on an instance of a DataBinding, you can set binding-specific converters (through DataBinding.sourceToUiConverters and DataBinding.uiToSourceConverters), which can use a closure.

Yes, during the update of a DataBinding, the dataSourcePath of an element is computed by combining all dataSourcePath between the element and the resolved dataSource.

That is not currently a feature supported by the UXML format. I would suggest to make a feature request for this.

Hope this helps!