I have an EditorDocumentViewer placed as content to a BackstageTab labeled "Print". I populate the Document property with the a FixedDocument created by the actively displayed syntaxeditor using the "editor.PrintSettings.CreateFixedDocument(editor)" method. However the document does not display on the screen. All of the buttons become active and when I click the Print button the correct document prints. Here is the snipped of code I use to populate the Document property:
private void PrintBackstageTabBorder_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
var visible = e.NewValue as bool?;
if(visible != null && (DockingSite.ActiveWindow != null && (bool) visible)) {
var editor = DockingSite.ActiveWindow.Content as SyntaxEditor;
if(editor != null) {
editor.PrintSettings.DocumentTitle = editor.Document.FileName;
editor.PrintSettings.IsDocumentTitleMarginVisible = true;
editor.PrintSettings.IsLineNumberMarginVisible = App.Preferences.LineNumberMargin;
editor.PrintSettings.IsPageNumberMarginVisible = true;
editor.PrintSettings.IsSyntaxHighlightingEnabled = true;
editor.PrintSettings.IsWordWrapGlyphMarginVisible = true;
editor.PrintSettings.IsWhitespaceVisible = App.Preferences.Whitespace;
Viewer.Document = editor.PrintSettings.CreateFixedDocument(editor);
}
}
}
And here is XAML for the EditorDocumentViewer:
<ribbon:BackstageTab x:Name="PrintBackstageTab" Header="Print" KeyTipAccessText="P">
<Border x:Name="PrintBackstageTabBorder" Style="{StaticResource ContentBoxBorderStyle}" IsVisibleChanged="PrintBackstageTabBorder_IsVisibleChanged">
<syntaxeditor:EditorDocumentViewer x:Name="Viewer"
Margin="15,0,0,0"
DockPanel.Dock="Right" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</Border>
</ribbon:BackstageTab>
Any help would be appreciated. This works in the sample provided with the controls, but I can't seem to get it to work for me though.