2016-07-04 8 views
0

私はWindowsの普遍的なアプリケーションで作業しています。私はUWPの印刷機能に関する問題を抱えています。この問題では、印刷ボタンをクリックすると、動的に設計されたインボイスページが印刷されますが、ページ全体のレイアウトは印刷されません。xamlページのレイアウト全体が印刷レイアウトでカバーされていませんか?

私はxamlコードを入れています。

<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> 

画像: enter image description here

答えて

0

この問題を修正するには、これらのTextBlockためFontFamilyを設定することができます。 TextBlockFontFamilyを追加すると、正しく印刷されます。

TextBlockの中でFontFamily<TextBlock Name="invoice_subtotal" FontFamily="Arial Narrow" .../>のように1つずつ設定できます。すべてTextBlock sが「ゴシック」フォントを使用しているとして、あるいは、我々は

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

のように、このGrid内のすべてのTextBlock Sをターゲットスタイルでそれを設定することができます真剣にありがとうございました。私は過去10日間この問題に直面していました。あなたはとても天才です。私はたくさん試しましたが、私は何の解決策も得ていませんでした。しかし、本当にありがとうございます。 –

関連する問題