Binding Page's Command within ListView of ContentView

IRONicMANIRONicMAN Member ✭✭
edited June 26 in Xamarin.Forms

Within my ContentView (name=CvProduct) I have a ListView (nam=LvProducts) and several controls within each cells with their specific commands that are accessible in the Page's (name=Products) viewmodel (name=ProductsViewModel). I cannot manage to make the bind works.

<ContentPage x:Name="Products">
 <ContentPage.Resources>
    <ResourceDictionary>
        <DataTemplate x:Key="ContentTemplate">
            <views:CvProduct/>
        </DataTemplate>
    </ResourceDictionary>
 </ContentPage.Resources>
</ContentPage>


<ContentView x:Name="CvProduct">
 <xForms:SfListView x:Name="LvProducts">
  <xForms:SfListView.ItemTemplate>
   <DataTemplate>
    <forms:SvgCachedImage.GestureRecognizers>
     <TapGestureRecognizer Command="{Binding BindingContext.ConsultElement,
 Source={x:Reference Name=LvProducts}}" CommandParameter="{Binding .}">
    </forms:SvgCachedImage.GestureRecognizers>
    </DataTemplate>
  </xForms:SfListView.ItemTemplate>
 </xForms:SfListView>
</ContentView>

which always returns this error :

Message = "Position xyz Can not find the object referenced by LvProducts"

Sign In or Register to comment.