Add BindingContextProvider
ChebanovDD opened this issue · 0 comments
ChebanovDD commented
To automatically provide a custom BindingContext
for child elements.
public class TestItemViewModel : ICollectionItem
{
[Observable]
private readonly IProperty<string> _name = new Property<string>();
...
}
public class TestViewModel : IBindingContext
{
[Observable]
private readonly IProperty<TestItemViewModel> _selectedItem;
}
[UxmlElement]
public partial class TestItemViewModelProvider : BindingContextProvider<TestItemViewModel>
{
}
<ui:UXML ...>
<BindableUIElements.TestItemViewModelProvider binding-context-path="SelectedItem">
<UnityMvvmToolkit.UITK.BindableUIElements.BindableLabel binding-text-path="Name" />
</BindableUIElements.TestItemViewModelProvider>
</ui:UXML>