我使用此链接中描述的示例为我的XAML UWP MVVM应用程序创建了打印解决方案:https://xamlbrewer.wordpress.com/2016/10/25/a-recipe-for-printing-in- uwp-mvvm-apps /(源代码在链接上:https://github.com/XamlBrewer/XamlBrewer.Uwp.PrintService)
我在笔记本电脑上打印的打印预览与我在松下CF-20上的打印预览不同。在thebook上布局搞砸了。
在笔记本电脑上(在几台笔记本电脑/ PC上看起来完全相同):
在thebook上:
我的报告页面(我用于预览/打印的页面):
<Page
x:Class="WK.Drf.FrontOffice.App.UI.DossierHandling.HandoverPrintReport"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WK.Drf.FrontOffice.App.UI.DossierHandling"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<RichTextBlock Height="640" VerticalAlignment="Bottom">
<Paragraph TextAlignment="Left" Margin ="55,0,0,0">
<Run Text="Overdracht" FontSize="30" FontWeight="Bold" />
<LineBreak />
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock TextWrapping="WrapWholeWords" FontWeight="Bold" Grid.Column="1" Grid.Row="0">RAV Kennemerland</TextBlock>
<TextBlock Text="{Binding AmbulanceNumber}" TextWrapping="WrapWholeWords" Grid.Column="1" Grid.Row="1" />
<TextBlock Text="{Binding ParamedicCode}" TextWrapping="WrapWholeWords" Grid.Column="1" Grid.Row="2" />
<TextBlock Text="{Binding DriverCode}" TextWrapping="WrapWholeWords" Grid.Column="1" Grid.Row="3" />
<TextBlock Text="{Binding ThirdPersonCode}" TextWrapping="WrapWholeWords" Grid.Column="1" Grid.Row="4" />
<TextBlock Text="{Binding PatientName}" TextWrapping="WrapWholeWords" FontWeight="Bold" Grid.Column="2" Grid.Row="0" />
<TextBlock Text="{Binding PatientDateOfBirth}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="1" />
<TextBlock Text="{Binding PatientAddress1}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="2" />
<TextBlock Text="{Binding PatientAddress2}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="3" />
<TextBlock Text="{Binding PatientBsn}" TextWrapping="WrapWholeWords" Grid.Column="3" Grid.Row="0" />
<TextBlock Text="{Binding PatientInsuranceCompany}" TextWrapping="WrapWholeWords" Grid.Column="3" Grid.Row="1"/>
<TextBlock Text="{Binding PatientInsuranceNo}" TextWrapping="WrapWholeWords" Grid.Column="3" Grid.Row="2" />
<TextBlock Text="{Binding PatientEmail}" TextWrapping="WrapWholeWords" Grid.Column="3" Grid.Row="3" />
<TextBlock Text="{Binding PatientPhoneNumber}" TextWrapping="WrapWholeWords" Grid.Column="3" Grid.Row="4" />
<TextBlock TextWrapping="WrapWholeWords" FontWeight="Bold" Grid.Column="4" Grid.Row="0" />
<TextBlock TextWrapping="WrapWholeWords" Grid.Column="4" Grid.Row="1" />
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Height="1" Fill="DarkGray"></Rectangle>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock FontSize="30" FontWeight="Bold" Grid.Column="0" Grid.RowSpan="8" TextAlignment="Left">S</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold" Visibility="{Binding Accident, Converter={StaticResource StringToVis}}">Ongeval:</TextBlock>
<TextBlock Text="{Binding Accident}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="0" Visibility="{Binding Accident, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold" Visibility="{Binding AmpleEvents, Converter={StaticResource StringToVis}}">Situatie:</TextBlock>
<TextBlock Text="{Binding AmpleEvents}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="1" Visibility="{Binding AmpleEvents, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold" Visibility="{Binding AirwayS, Converter={StaticResource StringToVis}}">A:</TextBlock>
<TextBlock Text="{Binding AirwayS}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="2" Visibility="{Binding AirwayS, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="3" FontWeight="Bold" Visibility="{Binding BreathingS, Converter={StaticResource StringToVis}}">B:</TextBlock>
<TextBlock Text="{Binding BreathingS}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="3" Visibility="{Binding BreathingS, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="4" FontWeight="Bold" Visibility="{Binding CirculationS, Converter={StaticResource StringToVis}}">C:</TextBlock>
<TextBlock Text="{Binding CirculationS}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="4" Visibility="{Binding CirculationS, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="5" FontWeight="Bold" Visibility="{Binding DisabilityS, Converter={StaticResource StringToVis}}">D:</TextBlock>
<TextBlock Text="{Binding DisabilityS}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="5" Visibility="{Binding DisabilityS, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="6" FontWeight="Bold" Visibility="{Binding ExposureS, Converter={StaticResource StringToVis}}">E:</TextBlock>
<TextBlock Text="{Binding ExposureS}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="6" Visibility="{Binding ExposureS, Converter={StaticResource StringToVis}}"/>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Height="1" Fill="DarkGray"></Rectangle>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock FontSize="30" FontWeight="Bold" Grid.Column="0" Grid.RowSpan="6" TextAlignment="Left">B</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold" Visibility="{Binding Allergy, Converter={StaticResource StringToVis}}">Allergie:</TextBlock>
<TextBlock Text="{Binding Allergy}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="0" Visibility="{Binding Accident, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold" Visibility="{Binding Medication, Converter={StaticResource StringToVis}}">Medicatie:</TextBlock>
<TextBlock Text="{Binding Medication}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="1" Visibility="{Binding Medication, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold" Visibility="{Binding PastIllnesses, Converter={StaticResource StringToVis}}">Verleden ziekten:</TextBlock>
<TextBlock Text="{Binding PastIllnesses}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="2" Visibility="{Binding PastIllnesses, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="3" FontWeight="Bold" Visibility="{Binding Insulation, Converter={StaticResource StringToVis}}">Isolatie:</TextBlock>
<TextBlock Text="{Binding Insulation}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="3" Visibility="{Binding Insulation, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="4" FontWeight="Bold" Visibility="{Binding InfectionRisk, Converter={StaticResource StringToVis}}">Besmettingsrisico:</TextBlock>
<TextBlock Text="{Binding InfectionRisk}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="4" Visibility="{Binding InfectionRisk, Converter={StaticResource StringToVis}}"/>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Height="1" Fill="DarkGray"></Rectangle>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock FontSize="30" FontWeight="Bold" Grid.Column="0" Grid.RowSpan="8" TextAlignment="Left">A</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" FontSize="20" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Bevindingen</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Hoofd en gelaat:</TextBlock>
<TextBlock Text="{Binding HeadAndFace}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="1" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Nek/Hals/CWK:</TextBlock>
<TextBlock Text="{Binding Neck}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="2" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="3" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Rug:</TextBlock>
<TextBlock Text="{Binding Back}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="3" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="4" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Thorax:</TextBlock>
<TextBlock Text="{Binding Thorax}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="4" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="5" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Arm:</TextBlock>
<TextBlock Text="{Binding Arms}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="5" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="6" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Abdomen:</TextBlock>
<TextBlock Text="{Binding Abdomen}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="6" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="7" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Bekken:</TextBlock>
<TextBlock Text="{Binding Pelvis}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="7" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="8" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Been:</TextBlock>
<TextBlock Text="{Binding Legs}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="8" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="9" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Uitscheiding:</TextBlock>
<TextBlock Text="{Binding Secreteion}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="9" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="10" FontWeight="Bold" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}">Verloskundig:</TextBlock>
<TextBlock Text="{Binding Gynecology}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="10" Visibility="{Binding HeadAndFace, Converter={StaticResource StringToVis}}"/>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="1" Grid.Row="0" FontSize="20" Visibility="{Binding TreatmentSectionVisibility}">Behandeling</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold" Visibility="{Binding AirwayT, Converter={StaticResource StringToVis}}">A:</TextBlock>
<TextBlock Text="{Binding AirwayT}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="1" Visibility="{Binding AirwayT, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold" Visibility="{Binding BreathingT, Converter={StaticResource StringToVis}}">B:</TextBlock>
<TextBlock Text="{Binding BreathingT}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="2" Visibility="{Binding BreathingT, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="3" FontWeight="Bold" Visibility="{Binding CirculationT, Converter={StaticResource StringToVis}}">C:</TextBlock>
<TextBlock Text="{Binding CirculationT}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="3" Visibility="{Binding CirculationT, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="4" FontWeight="Bold" Visibility="{Binding DisabilityT, Converter={StaticResource StringToVis}}">D:</TextBlock>
<TextBlock Text="{Binding DisabilityT}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="4" Visibility="{Binding DisabilityT, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="5" FontWeight="Bold" Visibility="{Binding ExposureT, Converter={StaticResource StringToVis}}">E:</TextBlock>
<TextBlock Text="{Binding ExposureT}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="5" Visibility="{Binding ExposureT, Converter={StaticResource StringToVis}}"/>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Height="1" Fill="DarkGray"></Rectangle>
</Grid>
</InlineUIContainer>
</Paragraph>
<Paragraph>
<InlineUIContainer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock FontSize="30" FontWeight="Bold" Grid.Column="0" Grid.RowSpan="6" TextAlignment="Left">R</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" FontSize="20" Visibility="{Binding AdditionalExplanation, Converter={StaticResource StringToVis}}">Verklaring Geen Vervoer</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold" Visibility="{Binding AdditionalExplanation, Converter={StaticResource StringToVis}}">Reden:</TextBlock>
<TextBlock Text="{Binding AdditionalExplanation}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="1" Visibility="{Binding AdditionalExplanation, Converter={StaticResource StringToVis}}"/>
<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold" Visibility="{Binding AdditionalExplanationText, Converter={StaticResource StringToVis}}">Toelichting:</TextBlock>
<TextBlock Text="{Binding AdditionalExplanationText}" TextWrapping="WrapWholeWords" Grid.Column="2" Grid.Row="2" Visibility="{Binding AdditionalExplanationText, Converter={StaticResource StringToVis}}"/>
</Grid>
</InlineUIContainer>
</Paragraph>
</RichTextBlock>
</Page>
我应该修复哪些内容才能在外页上获得正常的打印布局?
答案 0 :(得分:0)
我设法修复了我的解决方案 - 我已将所有TextBlocks放在边框内填充=&#34; 0&#34;余量=&#34; 0&#34;现在笔记本电脑和硬盘上的一切看起来都不错:
<Border Padding="0" Margin="0" Grid.Column="0" Grid.Row="1">
<TextBlock Padding="0" Margin="0" Text="{Binding AmbulanceNumber}"
TextWrapping="WrapWholeWords"/>
</Border>