Windows 10 UWP app c# Print

By : kendoo
Source: Stackoverflow.com
Question!

I want to print from a Windows 10 UWP app. In addition I have formatted the text as follows:

<RichTextBlock xml:space="preserve" x:Name="TextContent" Grid.Row="1" Width="675" OverflowContentTarget="{Binding ElementName=FirstLinkedContainer}" FontSize="18" IsTextSelectionEnabled="True" TextAlignment="Left" VerticalAlignment="Top" HorizontalAlignment="Left">
        <Paragraph>
            <InlineUIContainer>
                <StackPanel>
                    <Border Padding="2" BorderBrush="Black" Width="675" Height="Auto" BorderThickness="1">
                        <StackPanel Orientation="Horizontal" Margin="5,0,0,0" Height="20">
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                        </StackPanel>
                    </Border>
                </StackPanel>    
            </InlineUIContainer>
        </Paragraph>
    </RichTextBlock>

In the print preview the width wrong information the XAML TextBlock. The texts represented pulled apart.

How can I create a print page in XAML for Windows 10 print preview? Any help on this?

By : kendoo


Answers

I don't really understand what you mean by

The texts represented pulled apart.

Maybe it's because you used StackPanel Orientation="Horizontal" instead of StackPanel Orientation="Vertical"?

By : Nik A.


This video can help you solving your question :)
By: admin