Hi,
In my Xamarin application I use PRISM and on my pages I use the AutowireViewModel support for my viewmodels.
I'm also using ControlTemplates so I can easy change the look and feel.
<ContentView
ControlTemplate="{StaticResource LoginTemplate}">
</ContentView>
But the problem is that I can't get my bindings to work on my contentTempaltes.
I use TemplateBinding and tried BindigContext.
<Label Text="{TemplateBinding BindingContext.Text" FontSize="Large" HorizontalOptions="Center" Margin="0, 30, 0, 0" />
I also tried the Parent. but no bindings.
<Label Text="{TemplateBinding Parent.Text" FontSize="Large" HorizontalOptions="Center" Margin="0, 30, 0, 0" />
<Label Text="{TemplateBinding BindingContext.Parent.Text" FontSize="Large" HorizontalOptions="Center" Margin="0, 30, 0, 0" />
<Label Text="{Binding BindingContext.Text" FontSize="Large" HorizontalOptions="Center" Margin="0, 30, 0, 0" />
...
If I create a pure viewmodel with just some properties I can bind it when applying the BindingContext element inside my page.xaml
<ContentPage.BindingContext> <local:LoginViewModel /> </ContentPage.BindingContext>
But I want Prism to just set my AutowireViewModel to the BindixContext...
But how?
I have tried BindixContext="{TemplateBing ..."} as well without any progress.
Best Regards,
Tobias