Click here to Skip to main content
15,921,841 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi,

iam planning to show my report in Document-viewer.but the Document-viewer is
not showing in my form when i check the visibility it is false.how can
i change the visibility and see the document viewer .


using System;
using System.IO;
//using System.Windows.Controls;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Xps.Packaging;
using System.Xml;

namespace HelloXPSWorld {
  public partial class Form1: Form {
      DocumentViewer viewer;
      private System.Windows.Forms.TextBox txt;
    public Form1() {
      InitializeComponent();
    }

    private void Form1_Load(object sender,EventArgs e) {
      viewer = new DocumentViewer();
    XpsDocument xd = new XpsDocument("test.xps",FileAccess.ReadWrite);
     viewer.Document = xd.GetFixedDocumentSequence();
      viewer.Visibility = Visibility.Collapsed;
     bool bln = viewer.IsVisible;//here it is false
    viewer.BringIntoView();
    }
  }
}
Posted
Updated 20-Dec-17 17:07pm
v2

You are you doing? At least remove viewer.Visibility = Visibility.Collapsed!
Also, add Controls.Add(viewer).

—SA
 
Share this answer
 
Comments
sajithnet 9-Jan-12 22:25pm    
Controls.Add(viewer)we can add only System.Windows.Forms(controls)
but Document-viewer(viewer) is a System.Windows.Controls.
in the case of visibility i removed what u told still iam getting
bool bln = viewer.IsVisible;//here it is false.
My need is to show the XPS report on XPSviewer but i
was not able to find any samples so i tried with Document-viewer.if u have any
good samples to show the XPS report on XPSviewer please send it.
Please provide document viewer asp dot net free source code
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900