Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Binding Page's Command within ListView of ContentView

$
0
0

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"


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>