PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Unable to render ListView in Xamarin forms
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3874
Page 1 of 1

Author:  Rajat [ Fri Nov 23, 2018 10:52 am ]
Post subject:  Unable to render ListView in Xamarin forms

<ContentPage.Content>
<ScrollView x:Name="MainPrint" Orientation="Both">
<StackLayout>
<!--BackgroundColor="#a7afbc"-->
<!--TextColor="#ffffff"-->
<StackLayout Spacing="5">
<StackLayout Orientation="Horizontal" Padding="10,10,10,0">
<Label x:Name="ID" FontSize="Medium" HorizontalOptions="StartAndExpand" />
<Label x:Name="Date" FontSize="Small" VerticalOptions="StartAndExpand" />
</StackLayout>
<StackLayout Orientation="Horizontal" Padding="10,0,10,0">
<Label x:Name="TNumber" HorizontalOptions="StartAndExpand" FontSize="Medium" />
<StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand">
<Image Source="rupeeicon.png" />
<Label x:Name="Total" FontSize="Medium" />
</StackLayout>
</StackLayout>
</StackLayout>
<StackLayout VerticalOptions="Fill">
<StackLayout Orientation="Horizontal" Padding="20,5,20,0" VerticalOptions="Fill">
<Label Text="Consgr" FontSize="Medium" HorizontalOptions="CenterAndExpand" TextColor="#2196F3" />
</StackLayout>
<StackLayout>
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label x:Name="Cor" Grid.Row="0" Grid.Column="0" FontSize="15" HorizontalOptions="CenterAndExpand" />
<Label x:Name="Con" Grid.Row="0" Grid.Column="1" FontSize="15" HorizontalOptions="CenterAndExpand" />
</Grid>
</StackLayout>
<BoxView BackgroundColor="Silver" HeightRequest="1" HorizontalOptions="FillAndExpand" />
</StackLayout>
<StackLayout VerticalOptions="Fill">
<StackLayout Orientation="Horizontal" Padding="20,5,20,0" VerticalOptions="Fill">
<Label Text="Truer" FontSize="Medium" HorizontalOptions="StartAndExpand" TextColor="#2196F3" />
<Label Text="Triver" FontSize="Medium" HorizontalOptions="EndAndExpand" TextColor="#2196F3" />
</StackLayout>
<StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="Good Wil)" Grid.Row="0" Grid.Column="0" FontSize="15" HorizontalOptions="CenterAndExpand" />
<Label x:Name="Trver" Grid.Row="0" Grid.Column="1" FontSize="15" HorizontalOptions="CenterAndExpand" />
</Grid>
</StackLayout>
</StackLayout>
<StackLayout Margin="0,10,0,0">
<StackLayout Orientation="Horizontal" VerticalOptions="Center" Padding="30,0,30,0" BackgroundColor="#DED4D4">
<Label Text="items" HorizontalOptions="StartAndExpand" TextColor="#2196F3" />
<Label Text="amount" HorizontalOptions="EndAndExpand" TextColor="#2196F3" />
</StackLayout>
</StackLayout>
<StackLayout>

<ListView pdf:ListRendererDelegate="{StaticResource PdfListViewRendererDelegate}" x:Name="GoodsList" HasUnevenRows="True" SeparatorVisibility="Default">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10,0,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="{Binding Item}" Grid.Row="0" Grid.Column="0" HorizontalOptions="StartAndExpand" />
<Label Text="{Binding Amount}" Grid.Row="0" Grid.Column="1" HorizontalOptions="EndAndExpand" />
<StackLayout Orientation="Horizontal" Grid.Row="1" Grid.Column="0">
<Label Text="{Binding Quantity}" />
<Label Text="x" />
<Label Text="{Binding Rate}" />
</StackLayout>
<Label Text="{Binding Unit}" Grid.Column="0" Grid.Row="2" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
<StackLayout>
<StackLayout Orientation="Horizontal" Padding="20,5,15,0">
<Label Text="Weight 3.00 Ton(PRE)" TextColor="#2196F3" HorizontalOptions="StartAndExpand" />
<Label Text="Amount" TextColor="#2196F3" HorizontalOptions="EndAndExpand" />
<Label x:Name="TotalAmount" />
</StackLayout>
</StackLayout>
<BoxView BackgroundColor="Silver" HeightRequest="1" HorizontalOptions="FillAndExpand" />
<StackLayout>
<StackLayout Orientation="Horizontal" Padding="0,5,15,0">
<Label Text="CGST" TextColor="#2196F3" HorizontalOptions="EndAndExpand" />
<Label x:Name="CGSTLabel" HorizontalOptions="EndAndExpand" />
</StackLayout>
<StackLayout Orientation="Horizontal" Padding="0,5,15,0">
<Label Text="SGST" TextColor="#2196F3" HorizontalOptions="EndAndExpand" />
<Label x:Name="SGSTLabel" HorizontalOptions="EndAndExpand" />
</StackLayout>
<StackLayout Orientation="Horizontal" Padding="0,5,15,0">
<Label Text="Total" TextColor="#2196F3" HorizontalOptions="EndAndExpand" />
<Label x:Name="SecondGrossTotal" HorizontalOptions="EndAndExpand" />
</StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage.Content>


This my code in XAML . i have passed MainPrint in
PDFManager.GeneratePDFFromView(MainPrint);

When i try to render my listview it doesnot show on the Pdf that i am generating.
have found the project on github and took reference from it-
https://github.com/akgulebubekir/PDFSharp.Xamarin.Forms.

But i am unable to render the listview.
Can anybody suggest any implementation.?

Author:  TH-Soft [ Fri Nov 23, 2018 11:17 am ]
Post subject:  Re: Unable to render ListView in Xamarin forms

Rajat wrote:
have found the project on github and took reference from it-
https://github.com/akgulebubekir/PDFSharp.Xamarin.Forms.
[...]
Can anybody suggest any implementation.?
Why don't you ask the question on GitHub?

Author:  dush135 [ Mon Jan 13, 2020 12:45 pm ]
Post subject:  Re: Unable to render ListView in Xamarin forms

Have you found a solution?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/