2016-07-04 18 views
0

Ich arbeite an Windows Universal App. Ich habe ein Problem hinsichtlich der Druckfunktionalität in UWP. In diesem Problem druckt ich, wenn ich auf den Druckknopf klicke, die Rechnungsseite, die dynamisch gestaltet ist, aber den Druck nicht das ganze Seitenlayout abdeckt.Print-Layout ist nicht das gesamte Layout der XAML-Seite abgedeckt?

Ich stelle gerade meinen XAML-Code.

<Grid Background="White"> 

     <Grid Name="gridpopup" Visibility="Visible" Background="White"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="50"></RowDefinition> 
       <RowDefinition Height="200"></RowDefinition> 
       <RowDefinition Height="*"></RowDefinition> 
       <RowDefinition Height="78"></RowDefinition> 
       <RowDefinition Height="150"></RowDefinition> 

      </Grid.RowDefinitions> 

      <StackPanel Orientation="Horizontal" Margin="10,10,0,0" Grid.Row="0"> 
       <TextBlock FontFamily="Arial Narrow" Text=" Print Order :" FontSize="20" Height="50" VerticalAlignment="Bottom" Foreground="#FFF05929" FontWeight="Bold" Margin="0,0,0,-10"/> 
       <TextBlock x:Name="invoice_inc_id" FontFamily="Arial Narrow" Text="{Binding id" FontSize="20" Height="40" VerticalAlignment="Top" Foreground="#FFF05929" FontWeight="Bold"/> 
      </StackPanel> 

      <StackPanel Grid.Row="1" BorderBrush="LightGray" BorderThickness="0,1,0,2"> 
       <Image Name="logo" Height="70" Margin="220,10,220,0"/> 
       <StackPanel Orientation="Horizontal" Margin="10,35,0,0" Height="36"> 
        <TextBlock FontFamily="Arial Narrow" Text=" Customer Name: " FontSize="18" Height="30" VerticalAlignment="Top" Foreground="Black" Margin="0,6,0,0"/> 
        <TextBlock Margin="15,7,0,0" Name="invoice_Customername" FontFamily="Arial Narrow" Text="{Binding customer_name}" FontSize="18" Height="24" VerticalAlignment="Top" Foreground="Black" /> 
       </StackPanel> 
       <StackPanel Orientation="Horizontal" Margin="12,10,-2,0" Height="36" HorizontalAlignment="Left" > 
        <TextBlock FontFamily="Arial Narrow" Text=" Phone/Email : " FontSize="18" Height="40" VerticalAlignment="Bottom" Foreground="Black" Margin="0,-4,0,0"/> 
        <TextBlock Margin="15,-5,0,0" Name="invoiceCustomeremail" FontFamily="Arial Narrow" Text="{Binding customer_email}" FontSize="18" Height="36" VerticalAlignment="Top" Foreground="Black" Width="210" /> 
       </StackPanel> 
      </StackPanel> 

      <ListView Grid.Row="2" Name="lstinvoice" IsHitTestVisible="False" BorderBrush="LightGray" BorderThickness="0,0,0,1"> 
       <ListView.Background> 
        <ImageBrush Stretch="Fill" ImageSource="Images/LoginImages/gradient_bg.png"/> 
       </ListView.Background> 
       <ListView.HeaderTemplate> 
        <DataTemplate> 
         <Grid Margin="0,5,0,8" Height="25"> 
          <Grid.ColumnDefinitions> 
           <ColumnDefinition Width="400"></ColumnDefinition> 
           <ColumnDefinition Width="200"></ColumnDefinition> 
           <ColumnDefinition Width="200"></ColumnDefinition> 
          </Grid.ColumnDefinitions> 
          <TextBlock Grid.Column="0" Text="Name" Foreground="#FF020202" FontSize="24" FontWeight="Bold" FontFamily="Raavi" SelectionHighlightColor="#FFE05022" VerticalAlignment="Center" Margin="25,0,2,3" Height="31"></TextBlock> 
          <TextBlock Grid.Column="1" Text="Quantity" Foreground="#FF040404" FontSize="24" FontWeight="Bold" FontFamily="Raavi" SelectionHighlightColor="#FFE05022" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,-5,-9"></TextBlock> 
          <TextBlock Grid.Column="2" Text="Price" Foreground="#FF080808" FontSize="24" FontWeight="Bold" FontFamily="Raavi" SelectionHighlightColor="#FFE05022" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,30,-9"></TextBlock> 

         </Grid> 
        </DataTemplate> 
       </ListView.HeaderTemplate> 
       <ListView.ItemTemplate> 
        <DataTemplate> 
         <StackPanel Grid.Row="2"> 
          <Grid> 
           <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="400"></ColumnDefinition> 
            <ColumnDefinition Width="200"></ColumnDefinition> 
            <ColumnDefinition Width="200"></ColumnDefinition> 
           </Grid.ColumnDefinitions> 
           <TextBlock Grid.Column="0" FontFamily="Arial Narrow" Text="{Binding name}" FontSize="18" Height="40" VerticalAlignment="Center" Foreground="Black" Margin="10,0,0,0" Width="400" TextWrapping="Wrap"/> 
           <TextBlock Grid.Column="1" FontFamily="Arial Narrow" Text="{Binding ordered_qty}" FontSize="18" Height="40" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="Black" Margin="0,0,28,0" Width="auto"/> 
           <TextBlock Grid.Column="2" FontFamily="Arial Narrow" Text="{Binding unit_price}" FontSize="18" Height="40" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="Black" Margin="0,0,40,0" Width="auto"/> 

          </Grid> 
         </StackPanel> 
        </DataTemplate> 
       </ListView.ItemTemplate> 
      </ListView> 
<Grid Grid.Row="3" Grid.RowSpan="2" Name="disscount_pnl_detail" Width="450" VerticalAlignment="Top" HorizontalAlignment="Left"> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="22"></RowDefinition> 
        <RowDefinition Height="22"></RowDefinition> 
        <RowDefinition Height="22"></RowDefinition> 
        <RowDefinition Height="22"></RowDefinition> 
        <RowDefinition Height="22"></RowDefinition> 
       </Grid.RowDefinitions> 

       <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="300"></ColumnDefinition> 
        <ColumnDefinition Width="150"></ColumnDefinition> 
       </Grid.ColumnDefinitions> 

       <TextBlock FontFamily="Arial Narrow" Text="Sub Total : " Grid.Row="0" Grid.Column="0" FontSize="18" TextAlignment="Right" Foreground="Black" Height="22" /> 
       <TextBlock Name="invoice_subtotal" Grid.Row="0" Grid.Column="1" Text="$0.00" HorizontalAlignment="Left" TextAlignment="Right" Foreground="#FFFF3400" FontSize="20" /> 

       <TextBlock FontFamily="Arial Narrow" Text="Discount : " Grid.Column="0" Grid.Row="1" FontSize="18" TextAlignment="Right" Foreground="Black" Height="22" /> 
       <TextBlock Text="$0.00" Name="invoice_discount" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" TextAlignment="Right" Foreground="#FFFF3400" FontSize="20" /> 


       <TextBlock FontFamily="Arial Narrow" Text="Tax : " Grid.Row="2" Grid.Column="0" FontSize="18" TextAlignment="Right" Foreground="Black" Height="22" /> 
       <TextBlock Text="$0.00" Name="invoice_tax" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right" Foreground="#FFFF3400" FontSize="20" /> 

       <TextBlock FontFamily="Arial Narrow" Text="Shipping And Handling : " FontSize="18" Foreground="Black" TextAlignment="Right" Grid.Row="3" Grid.Column="0" /> 
       <TextBlock Name="invoice_shippingcharge" Text="$0.00" HorizontalAlignment="Left" Foreground="#FFFF3400" TextAlignment="Right" FontSize="20" Grid.Row="3" Grid.Column="1" /> 

       <TextBlock FontFamily="Arial Narrow" Text="Grand Total :" FontSize="22" Foreground="Black" TextAlignment="Right" FontWeight="Bold" Grid.Row="4" Grid.Column="0"/> 
       <TextBlock Name="invoice_grandtotal" Text="$0.00" HorizontalAlignment="Left" Foreground="#FFFF3400" FontSize="20" TextAlignment="Right" Grid.Row="4" Grid.Column="1" /> 


      </Grid> 
    </Grid> 




    </Grid> 
</Page> 

Image: enter image description here

Antwort

0

um dieses Problem zu beheben, können Sie FontFamily für diejenigen TextBlock gesetzt. Sobald Sie FontFamily in diesen TextBlock hinzufügen, werden sie ordnungsgemäß gedruckt.

Wir können setzen FontFamily in denen TextBlock wie <TextBlock Name="invoice_subtotal" FontFamily="Arial Narrow" .../> eins nach dem anderen. Oder wie alle TextBlock s verwenden „Arial Narrow“ Schriftart, können wir es in einem Stil, der gesetzt richten sich an alle TextBlock s in dieser Grid wie

<Grid Name="gridpopup" Background="White" Visibility="Visible"> 
    <Grid.Resources> 
     <Style TargetType="TextBlock"> 
      <Setter Property="FontFamily" Value="Arial Narrow" /> 
     </Style> 
    </Grid.Resources> 
    ... 
</Grid> 
+0

Danke so sehr ernst. Ich habe dieses Problem von den letzten 10 Tagen gesehen. Sie sind so Genius. Wirklich habe ich viel versucht, aber ich habe keine Lösung bekommen. Aber wirklich danke Ihnen so sehr für diese Lösung. –