0

我正在创建UWP应用程序。我想将打印功能添加到我的项目中。所以我使用RichTextBlock将页面发送到预览。所有预览工作正常。但是当项目列表进入运行时,即(来自数据库)时,我有很大的错误。当项目从运行时获取时,溢出无法正常工作。但它适用于预定义的段落集。请帮我解决问题。

<RichTextBlock x:Name="takeprint"  Grid.Row="1" Width="770"  OverflowContentTarget="{Binding ElementName=ContinuationPageLinkedContainer}"  Margin="0 10 0 0" >
        <Paragraph>
            <InlineUIContainer>
                <RichTextBlock>
                    <Paragraph>
                        <InlineUIContainer>
                            <Grid x:Name="top"  Margin="0 30 0 0" HorizontalAlignment="Stretch" VerticalAlignment="Center"   Background="Black">
                                <RelativePanel Height="40" Width="auto" Background="#32b38c">
                                    <TextBlock x:Name="sno" RelativePanel.AlignLeftWithPanel="True" Text="Sno" Width="40" Margin="5,10,10,10"  HorizontalAlignment="Center" Style="{StaticResource ptextblock}" VerticalAlignment="Center"/>
                                    <TextBlock x:Name="name" RelativePanel.RightOf="sno" Text="Name" Width="90" Margin="0,10,0,10"  Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock x:Name="schoolname" RelativePanel.RightOf="name" Text="School Name" Width="90" Margin="5,10,0,10"   Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock x:Name="appdate" RelativePanel.RightOf="schoolname" Text="App Date" Width="70" Margin="5,10,0,10"  Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock x:Name="returndate" RelativePanel.RightOf="appdate" Text="Return Date"  Width="70" Margin="5,10,0,10" Style="{StaticResource ptextblock}"  />
                                    <TextBlock x:Name="checkno" RelativePanel.RightOf="returndate" Text="CheckNo"  Width="80" Margin="5,10,0,10"  Style="{StaticResource ptextblock}" VerticalAlignment="Center"   HorizontalAlignment="Center" />
                                    <TextBlock x:Name="fees" RelativePanel.RightOf="checkno" Text="Fees" Width="70" Margin="0,10,0,10"   Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock x:Name="CabCost" RelativePanel.RightOf="fees" Text="CabCost" Width="70" Margin="0,10,0,10"   Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock x:Name="ticamt" RelativePanel.RightOf="CabCost"  Text="Tic amt"  Width="55" Margin="0,10,0,10"  Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock x:Name="totalcost" RelativePanel.RightOf="ticamt" Text="Total Cost" Width="100" Margin="0,10,0,10"   Style="{StaticResource ptextblock}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </RelativePanel>
                            </Grid>
                        </InlineUIContainer>
                    </Paragraph>
                    <Paragraph></Paragraph>
                    <Paragraph>
                        <InlineUIContainer>
                            <ItemsControl x:Name="Reportview">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <RelativePanel Margin="0 20 0 0">
                                            <TextBlock x:Name="sno" RelativePanel.AlignLeftWithPanel="True" Margin="5,0,0,0" Text="{Binding Sno}"   VerticalAlignment="Center"  Width="40" Style="{StaticResource ptextblock}" />
                                            <TextBlock x:Name="name" RelativePanel.RightOf="sno" Text="{Binding Name}"  VerticalAlignment="Center" TextWrapping="WrapWholeWords"  Width="90" Style="{StaticResource ptextblock}" />
                                            <TextBlock x:Name="schoolname" RelativePanel.RightOf="name" Text="{Binding SchoolName}" VerticalAlignment="Center" TextWrapping="WrapWholeWords"  Width="90" Style="{StaticResource ptextblock}" />
                                            <TextBlock x:Name="appdate" RelativePanel.RightOf="schoolname" Text="{Binding AppDate1}"  VerticalAlignment="Center" TextWrapping="Wrap" Width="90" Style="{StaticResource ptextblock}"/>
                                            <TextBlock x:Name="returndate" RelativePanel.RightOf="appdate" Text="{Binding ReturnDate1}" VerticalAlignment="Center" TextWrapping="Wrap" Width="90" Style="{StaticResource ptextblock}"/>
                                            <TextBlock x:Name="checkno" RelativePanel.RightOf="returndate" Text="{Binding CheckNo}" VerticalAlignment="Center" Width="60" TextWrapping="Wrap"    Style="{StaticResource ptextblock}"/>
                                            <TextBlock x:Name="fees" RelativePanel.RightOf="checkno" Text="{Binding Fees}" VerticalAlignment="Center" Width="70" TextWrapping="Wrap"    Style="{StaticResource ptextblock}"/>
                                            <TextBlock x:Name="Cabcost" RelativePanel.RightOf="fees" Text="{Binding CabCost}" VerticalAlignment="Center" Width="70" TextWrapping="Wrap"    Style="{StaticResource ptextblock}"/>
                                            <TextBlock x:Name="ticketamount"  RelativePanel.RightOf="Cabcost" Text="{Binding TicketAmount}" VerticalAlignment="Center" Width="60" TextWrapping="Wrap"   Style="{StaticResource ptextblock}"/>
                                            <TextBlock x:Name="totalcost" RelativePanel.RightOf="ticketamount" Text="{Binding TotalCost}" VerticalAlignment="Center" Width="80" TextWrapping="Wrap"  Style="{StaticResource ptextblock}"/>
                                        </RelativePanel>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </InlineUIContainer>
                    </Paragraph>
                </RichTextBlock>
            </InlineUIContainer>
        </Paragraph>
    </RichTextBlock>
    <RichTextBlockOverflow x:Name="FirstLinkedContainer"  OverflowContentTarget="{Binding ElementName=ContinuationPageLinkedContainer}" Grid.Row="2"/>
    <RichTextBlockOverflow x:Name="ContinuationPageLinkedContainer" Grid.Row="3"/>

即使列表有更多行数,也不会发生溢出,它仅显示 grid.rows 高度的高度。但是当预定义的段落集时溢出可以正常工作。代码内部没有任何更改。

   <RichTextBlock x:Name="takeprint"  Grid.Row="1" Width="770"  OverflowContentTarget="{Binding ElementName=ContinuationPageLinkedContainer}"  Margin="0 10 0 0" >
     <Paragraph>Sed convallis ornare velit et interdum. Donec sapien neque, aliquet consequat convallis at, interdum et enim. Donec iaculis, lectus vel pulvinar cursus, lectus diam interdum ante, a rhoncus tortor quam porta metus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam pulvinar fringilla vestibulum. Pellentesque pharetra nunc in turpis tempus sed faucibus ligula sagittis. Praesent hendrerit est vitae lorem mattis in porttitor urna vestibulum. Phasellus adipiscing aliquam libero ac adipiscing. In a erat sit amet erat sollicitudin bibendum id vitae dui. Vestibulum non consequat nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris elit nisi, blandit et porttitor quis, malesuada nec mi.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph >Aliquam erat volutpat. In non urna ut libero ultricies fringilla. Proin tellus neque, aliquam lacinia consequat at, vulputate et arcu. Maecenas odio nunc, lobortis sit amet pulvinar sit amet, accumsan et leo. Suspendisse erat lectus, commodo ac auctor eget, rutrum in mi. Suspendisse potenti. Proin ac elit non lacus rutrum mollis. Vivamus venenatis, tellus vel placerat lacinia, arcu ligula dignissim orci, consectetur consectetur eros massa vel nulla. Quisque malesuada iaculis ornare. Nullam tincidunt accumsan egestas. Mauris sit amet scelerisque arcu. Proin euismod sodales magna faucibus commodo. Nam in fringilla orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph >Sed eget nunc quis tellus interdum aliquet. Suspendisse rhoncus malesuada nisi a imperdiet. Suspendisse ullamcorper mi sed purus tristique interdum. Mauris lobortis, ante ultrices varius consequat, eros ante hendrerit enim, vulputate convallis dui ligula eget velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec eget lectus fermentum nisi consequat dictum. Sed volutpat justo non purus semper vel pretium enim molestie. Nam consectetur, lectus quis feugiat malesuada, neque nunc faucibus velit, nec vehicula risus est id sapien. Vestibulum ut metus massa, ut placerat lacus. Fusce condimentum vehicula tortor, nec vestibulum ligula iaculis ut. Nulla facilisi. Phasellus tincidunt scelerisque erat, ut fermentum urna pretium eu. Donec ut nibh orci. Curabitur sodales metus dictum mauris varius vitae mollis tellus pulvinar. Quisque facilisis ligula sed risus laoreet non lacinia odio luctus. Nam lobortis rhoncus felis vitae ultrices.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph>Aliquam erat volutpat. In non urna ut libero ultricies fringilla. Proin tellus neque, aliquam lacinia consequat at, vulputate et arcu. Maecenas odio nunc, lobortis sit amet pulvinar sit amet, accumsan et leo. Suspendisse erat lectus, commodo ac auctor eget, rutrum in mi. Suspendisse potenti. Proin ac elit non lacus rutrum mollis. Vivamus venenatis, tellus vel placerat lacinia, arcu ligula dignissim orci, consectetur consectetur eros massa vel nulla. Quisque malesuada iaculis ornare. Nullam tincidunt accumsan egestas. Mauris sit amet scelerisque arcu. Proin euismod sodales magna faucibus commodo. Nam in fringilla orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph >Sed eget nunc quis tellus interdum aliquet. Suspendisse rhoncus malesuada nisi a imperdiet. Suspendisse ullamcorper mi sed purus tristique interdum. Mauris lobortis, ante ultrices varius consequat, eros ante hendrerit enim, vulputate convallis dui ligula eget velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec eget lectus fermentum nisi consequat dictum. Sed volutpat justo non purus semper vel pretium enim molestie. Nam consectetur, lectus quis feugiat malesuada, neque nunc faucibus velit, nec vehicula risus est id sapien. Vestibulum ut metus massa, ut placerat lacus. Fusce condimentum vehicula tortor, nec vestibulum ligula iaculis ut. Nulla facilisi. Phasellus tincidunt scelerisque erat, ut fermentum urna pretium eu. Donec ut nibh orci. Curabitur sodales metus dictum mauris varius vitae mollis tellus pulvinar. Quisque facilisis ligula sed  risus laoreet non lacinia odio luctus. Nam lobortis rhoncus felis vitae ultrices.</Paragraph>
        <Paragraph>Sed convallis ornare velit et interdum. Donec sapien neque, aliquet consequat convallis at, interdum et enim. Donec iaculis, lectus vel pulvinar cursus, lectus diam interdum ante, a rhoncus tortor quam porta metus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam pulvinar fringilla vestibulum. Pellentesque pharetra nunc in turpis tempus sed faucibus ligula sagittis. Praesent hendrerit est vitae lorem mattis in porttitor urna vestibulum. Phasellus adipiscing aliquam libero ac adipiscing. In a erat sit amet erat sollicitudin bibendum id vitae dui. Vestibulum non consequat nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris elit nisi, blandit et porttitor quis, malesuada nec mi.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph >Aliquam erat volutpat. In non urna ut libero ultricies fringilla. Proin tellus neque, aliquam lacinia consequat at, vulputate et arcu. Maecenas odio nunc, lobortis sit amet pulvinar sit amet, accumsan et leo. Suspendisse erat lectus, commodo ac auctor eget, rutrum in mi. Suspendisse potenti. Proin ac elit non lacus rutrum mollis. Vivamus venenatis, tellus vel placerat lacinia, arcu ligula dignissim orci, consectetur consectetur eros massa vel nulla. Quisque malesuada iaculis ornare. Nullam tincidunt accumsan egestas. Mauris sit amet scelerisque arcu. Proin euismod sodales magna faucibus commodo. Nam in fringilla orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph >Sed eget nunc quis tellus interdum aliquet. Suspendisse rhoncus malesuada nisi a imperdiet. Suspendisse ullamcorper mi sed purus tristique interdum. Mauris lobortis, ante ultrices varius consequat, eros ante hendrerit enim, vulputate convallis dui ligula eget velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec eget lectus fermentum nisi consequat dictum. Sed volutpat justo non purus semper vel pretium enim molestie. Nam consectetur, lectus quis feugiat malesuada, neque nunc faucibus velit, nec vehicula risus est id sapien. Vestibulum ut metus massa, ut placerat lacus. Fusce condimentum vehicula tortor, nec vestibulum ligula iaculis ut. Nulla facilisi. Phasellus tincidunt scelerisque erat, ut fermentum urna pretium eu. Donec ut nibh orci. Curabitur sodales metus dictum mauris varius vitae mollis tellus pulvinar. Quisque facilisis ligula sed risus laoreet non lacinia odio luctus. Nam lobortis rhoncus felis vitae ultrices.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph>Aliquam erat volutpat. In non urna ut libero ultricies fringilla. Proin tellus neque, aliquam lacinia consequat at, vulputate et arcu. Maecenas odio nunc, lobortis sit amet pulvinar sit amet, accumsan et leo. Suspendisse erat lectus, commodo ac auctor eget, rutrum in mi. Suspendisse potenti. Proin ac elit non lacus rutrum mollis. Vivamus venenatis, tellus vel placerat lacinia, arcu ligula dignissim orci, consectetur consectetur eros massa vel nulla. Quisque malesuada iaculis ornare. Nullam tincidunt accumsan egestas. Mauris sit amet scelerisque arcu. Proin euismod sodales magna faucibus commodo. Nam in fringilla orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</Paragraph>
        <Paragraph></Paragraph>
        <Paragraph >Sed eget nunc quis tellus interdum aliquet. Suspendisse rhoncus malesuada nisi a imperdiet. Suspendisse ullamcorper mi sed purus tristique interdum. Mauris lobortis, ante ultrices varius consequat, eros ante hendrerit enim, vulputate convallis dui ligula eget velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec eget lectus fermentum nisi consequat dictum. Sed volutpat justo non purus semper vel pretium enim molestie. Nam consectetur, lectus quis feugiat malesuada, neque nunc faucibus velit, nec vehicula risus est id sapien. Vestibulum ut metus massa, ut placerat lacus. Fusce condimentum vehicula tortor, nec vestibulum ligula iaculis ut. Nulla facilisi. Phasellus tincidunt scelerisque erat, ut fermentum urna pretium eu. Donec ut nibh orci. Curabitur sodales metus dictum mauris varius vitae mollis tellus pulvinar. Quisque facilisis ligula sed  risus laoreet non lacinia odio luctus. Nam lobortis rhoncus felis vitae ultrices.</Paragraph>
    </RichTextBlock>
    <RichTextBlockOverflow x:Name="FirstLinkedContainer"  OverflowContentTarget="{Binding ElementName=ContinuationPageLinkedContainer}" Grid.Row="2"/>
    <RichTextBlockOverflow x:Name="ContinuationPageLinkedContainer" Grid.Row="3"/>

此代码正常工作,那么上面代码中的问题是什么。

4

0 回答 0