Xamarin froms, how to use content view in list view in .cs file

AfsarunnisaMdAfsarunnisaMd USMember ✭✭
edited July 2017 in Xamarin.Forms

I have some customised content view in Xamarin from app, I am using that content view in list view using xcml page

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="MyCart.Views.AllProductsListPage"
           xmlns:view="clr-namespace:MyCart.Controls;assembly=MyCart"
            >


 <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <view:CardViewTemplate/>
  </ViewCell>

                    </DataTemplate>
                </ListView.ItemTemplate>

            </ListView>

Same thing I want to access it from ,cs file how to do that ...

        var listView = new ListView { ItemTemplate = CardViewTemplate, RowHeight = 160 };

it is throwing error, how can we add template to list view ?

Sign In or Register to comment.