Note that there are some explanatory texts on larger screens.

plurals
  1. POPrinting AllPages with FlowDocumentScrollViewer
    primarykey
    data
    text
    <p>In a <a href="https://stackoverflow.com/q/11383147/1509853">previous question</a> I was trying to print from my TreeView, now i go to the parent view and I have hare an UserControl how contain an TreeView to display my search result on my WPFview, i tryed to print it and i surround with FlowDocumentScrollViewer as the code below:</p> <p><em>view.xaml</em></p> <pre><code>&lt;FlowDocumentScrollViewer x:Name="flow" Margin="10" BorderThickness="0"&gt; &lt;FlowDocument&gt; &lt;Section&gt; &lt;BlockUIContainer&gt; &lt;my:SearchTreeView Content="{Binding Stvm}"/&gt; &lt;/BlockUIContainer&gt; &lt;/Section&gt; &lt;/FlowDocument&gt; </code></pre> <p></p> <p><em>view.xaml.cs</em></p> <pre><code> Printing.PrintDoc( flow.Document, txtSearch.Text + " - Result"); </code></pre> <p><em>static printing.cs</em></p> <pre><code>public static void PrintDoc(System.Windows.Documents.FlowDocument fd, string description) { double h, w, cw; h = fd.PageHeight ; w = fd.PageWidth ; cw = fd.ColumnWidth; PrintDialog pd = new PrintDialog(); //pd.PageRangeSelection = PageRangeSelection.AllPages; //pd.UserPageRangeEnabled = true; if (pd.ShowDialog() != true || fd == null) return; fd.PageHeight = pd.PrintableAreaHeight; fd.PageWidth = pd.PrintableAreaWidth; fd.PagePadding = new Thickness(50); fd.ColumnGap = 0; fd.ColumnWidth = pd.PrintableAreaWidth; System.Windows.Documents.IDocumentPaginatorSource dps = fd; // int c = dps.DocumentPaginator.PageCount;//0 pd.PrintDocument(dps.DocumentPaginator, description); fd.PageHeight = h; fd.PageWidth = w; fd.PagePadding = new Thickness(0); fd.ColumnWidth = cw; } </code></pre> <p>i tryed almost all the exmple in the Similar Questions but the best i got is just the <strong>first page</strong> of result like <a href="https://i.stack.imgur.com/8Fglt.png" rel="nofollow noreferrer">this</a>.. ;(</p> <p>I'm Using WPF MVVM pattern. Is this is the right control to do it?Or shall I go for any other WPF controls.?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload