Hello,
I'm using compiled binding on my MainPage.
<ContentPage.BindingContext>
<viewmodels:MainPageViewModel x:DataType="viewmodels:MainPageViewModel"/>
</ContentPage.BindingContext>
For a ListView I added a DataTemplateSelector in the ContentPage.Resources section.
<ContentPage.Resources>
<DataTemplate x:Key="headingTemplate">
<ViewCell x:DataType="viewmodels:MainPageViewModel" BindableLayout.ItemsSource="{Binding Items}">
<Label Text="{Binding ?} " BackgroundColor="Yellow"/>
</ViewCell>
</DataTemplate>
<DataTemplate x:Key="notEditableTemplate">
<ViewCell x:DataType="viewmodels:MainPageViewModel" BindableLayout.ItemsSource="{Binding Items}">
<Label Text="{Binding ?}" BackgroundColor="Green"/>
</ViewCell>
</DataTemplate>
<helpers:MainPageDataTemplateSelector x:Key="DataTemplateSelector"
HeadingTemplate="{StaticResource headingTemplate}"
NotEditableTemplate="{StaticResource notEditableTemplate}"/>
</ContentPage.Resources>
The ListView consumes the DataTemplateSelector as followed.
<ListView BackgroundColor="White"
ItemsSource="{Binding Items}"
ItemTemplate="{StaticResource DataTemplateSelector}"/>
My question is, how can I bind the Text-Property of the label in the ContentPage.Resources section, where I added <Label Text="{Binding ?} ".../>
?