Application creation

<< Click to Display Table of Contents >>

Navigation:  Gnostice Document Studio .NET > Getting Started > Document Viewing > WPF >

Application creation

Steps to create a basic WPF document viewer application.

1.Open Visual Studio and create a new WPF application.

2.Use either the GUI or the Package Manager Console and install the Gnostice.DocumentStudio.WPF NuGet package.

3.Build the project so that the product assemblies are copied to the bin folder.

4.Follow the step below if the Gnostice DocumentViewer control doesn't show up in the toolbox.

a.In the toolbox, add a new tab for Document Studio .NET.

b.On this tab, add the Gnostice.Controls.WPF.dll assembly from the bin\debug or bin\release folder of your project. This will add a new DocumentViewer control to the tab.

5.Drop the following components on to the form:

Button

Gnostice.Controls.WPF.DocumentViewer

6.Arrange the button such that it is on top of the form and the Document Viewer control is after it.

7.Set the name of the Button control to Button1 and name the WPF viewer control to WpfDocumentViewer.

8.Double-click the button and add the following handler for the click event.

 

 

    private void Button1_Click(object sender, RoutedEventArgs e)
    {
        // Provide the file name with path
        WpfDocumentViewer.LoadDocument("sample.docx");
    }

 

 

9.Build the project and run.