Results 1 to 4 of 4

Thread: Silverlight 4 DataGrid is not printing properly.

  1. #1
    Join Date
    Apr 2010
    Posts
    80

    Silverlight 4 DataGrid is not printing properly.

    I have a datagrid and after a good configuration, I am trying to print this wit the help of following code :

    Code:
    { 
    
    PrintDocument prnt_doc = new PrintDocument();
                prnt_doc.PrintPage += (p, args) =>
                {
          
                    args.PageVisual = tblSolutionDesignCurrentDataGrid;
                    args.HasMorePages = true;
                };
    
                prnt_doc.EndPrint += (p, args) =>
                {
                    
                    MessageBox.Show("Printing operation finished");
                };
    
                prnt_doc.Print("Current Server Description");
                }
    But the problem is that I am getting only the headers and scrollbars. I used paging with the help of a datapager. when I try to move to print this, content shows blank..!

  2. #2
    Join Date
    May 2008
    Posts
    388

    Re: Silverlight 4 DataGrid is not printing properly.

    Before, you are going to print , we require to generate a UserControl to hold the layout. I have generated a UserControl known as PrintPage that does exactly same . Just take a look at these configuration and declaration . The XAML code is maintains easy to describe the methodologies:

    <Grid x:Name="documentRoot">
    <Grid.RowDefinitions>
    <RowDefinition Height="30"/>
    <RowDefinition />
    <RowDefinition Height="30"/>
    </Grid.RowDefinitions>

    <TextBlock x:Name="headerTextBlock" HorizontalAlignment="Center" />

    <TextBlock x:Name="bodyTextBlock" Grid.Row="1" TextWrapping="Wrap" />

    <TextBlock x:Name="footerTextBlock" HorizontalAlignment="Center" Grid.Row="2"/>
    </Grid>

  3. #3
    Join Date
    Apr 2010
    Posts
    80

    Re: Silverlight 4 DataGrid is not printing properly.

    I am not sure about the procedure to iterate via the collection from code behind as, the datagrid itemssource just provides the components or rows that are seen. But not sure about the procedure to loop via the pages and get components.

    I have tried casting the datagrid itemssource to DomainDataSourceView and then after trying to GetItemAt(). but not able to do that as not getting able to find the components at n+1th status and throws an arrayoutofbound exception..

  4. #4
    Join Date
    Apr 2008
    Posts
    513

    Re: Silverlight 4 DataGrid is not printing properly.

    You are doing fine but you may be doing little bit mistakes here.Actually, in silverlight, when you are going for pringting then the concept behind this is actually you are printing the Visual components . It doesn't matter that it is a ObservableCollection or List as underlying data. You don't require to iterate the data itself.According to your situation, you need to print the DataGrid.

Similar Threads

  1. HP 1200 printing not working properly with mac os x
    By Loverface in forum Hardware Peripherals
    Replies: 3
    Last Post: 25-09-2011, 07:32 PM
  2. How to do Printing in Silverlight Beta 4
    By Tweaker in forum Tips & Tweaks
    Replies: 3
    Last Post: 27-09-2010, 10:40 PM
  3. Printing and Parameters issues in Silverlight Beta 4
    By Mulan in forum Windows Software
    Replies: 5
    Last Post: 05-08-2010, 11:14 PM
  4. how VIBlend DataGrid for Silverlight is the most flexible control
    By Aandaleeb in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 01:01 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,716,555,705.65464 seconds with 17 queries