TabViewProperty
This is a BindableProperty
used when declaring bindings for TabView
.
How to Declare
As with BindableProperty
, you can declare by calling TabViewProperty<T>.Create()
.<T>
specifies the type of ViewModel you want to bind to the TabView
.
private static readonly TabViewProperty<ShowcaseViewModel> TabProperty =
TabViewProperty<ShowcaseViewModel>.Create(
tabContentViewInfoList: new[]
{
(
viewGuid: ControlsShowcaseLayout.UxmlGuid,
labelDataSourcePath: PropertyPath.Combine(
PropertyPath.FromName(nameof(ShowcaseViewModel.Controls)),
PropertyPath.FromName(nameof(ControlsShowcaseViewModel.TabLabel))
)
),
(
viewGuid: ListViewShowcaseLayout.UxmlGuid,
labelDataSourcePath: PropertyPath.Combine(
PropertyPath.FromName(nameof(ShowcaseViewModel.ListView)),
PropertyPath.FromName(nameof(ListViewShowcaseViewModel.TabLabel))
)
)
},
elementNameInfo: ElementNames.RootTab
);
Parameters
TabViewProperty<T>.Create()
can specify the following parameters:
Parameter | Type | Required | Default Value |
---|---|---|---|
tabContentViewInfoList | IEnumerable<(string viewGuid, PropertyPath labelDataSourcePath)> | yes | - |
elementNameInfo | ElementNameInfo | yes | - |
tabContentViewInfoList
TabViewProperty
generatesTab
s.
IntabContentViewInfoList
, you can specify a list of View classes to be associated with the generatedTab
.
The ViewModel bound to theTabView
has the type specified by<T>
.
If you want to bind a different ViewModel to the View specified intabContentViewInfoList
, the View class specified must inherit fromHaikaraViewModelProvidableBase
.viewGuid
Specifies the Guid of the View class. For the assembly containing the View class with the specified Guid, you need to callViewInstaller.Install()
in advance.
Using this Guid, theVisualTreeAsset
that becomes the content of eachTab
is obtained and instantiated, and data binding is performed by the View class.labelDataSourcePath
Specifies the data source for the label on the TabView.
elementNameInfo
Specifies which TabView to construct the binding for.