我想知道这是否是打印flowdocument的正确方法:( 但这是一个非常奇怪的现象。
我的代码是这样的:
string flowDocString =
" <FlowDocument xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" +
" <Section>" +
" <Paragraph>" +
" <CheckBox IsChecked='True'>Test</CheckBox>" +
" </Paragraph>" +
" </Section>" +
" </FlowDocument>";
FlowDocument flowDoc = (FlowDocument)XamlReader.Load(new MemoryStream(new UTF8Encoding().GetBytes(flowDocString)));
PrintDialog printDlg = new PrintDialog();
IDocumentPaginatorSource idpSource = flowDoc;
printDlg.PrintDocument(idpSource.DocumentPaginator, "Hello WPF Printing.");
当我使用此代码时,复选框的状态仍未选中。 但是当我像这样修改flowDocString时:
string flowDocString =
" <FlowDocument xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" +
" <Section>" +
" <Paragraph>" +
" <CheckBox IsChecked='True' IsEnabled='False'>Test</CheckBox>" +
" </Paragraph>" +
" </Section>" +
" </FlowDocument>";
如果修改上述结果将按预期显示。 这怎么可能发生?请告诉我原因。