I have two Pages used for printing.
1) PagePrinting.xaml
2) FormattedPage.xaml
in PagePrinting.xaml , I used the code below to reference the FormattedPage.xaml
FrameworkElement page1;
page1 = new FormattedPage();
CanvasPrintContainer.Children.Add(page1);
The problem:
- The txtBlkDatePrint is blank when it is shown in PagePrinting.xaml
What I need to do?
in CodeBehind of FormattedPage.xaml :
protected override void OnNavigatedTo(NavigationEventArgs e)
{
txtBlkDatePrint.Text = DateTime.Today.ToString("d");
}
FormattedPage.xaml:
< StackPanel x:Name="header" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="0" Height="60">
<StackPanel Orientation="Horizontal" >
<RichTextBlock Foreground="Black" FontSize="20" TextAlignment="Left" FontFamily="Segoe UI">
<Paragraph>
<TextBlock x:Name="txtBlkDatePrint" Margin="10,10,0,0" HorizontalAlignment="Left" TextWrapping="Wrap" FontSize="28" Text="" VerticalAlignment="Top" Height="39" Width="204"/>
</Paragraph>
</RichTextBlock>
</StackPanel>
</StackPanel>