padsjae.blogg.se

.wpd viewer
.wpd viewer










.wpd viewer

If we want to clear the XML display from the user control, we can simply assign " null" to the " xmlDocument" property. After the " XMLDodument" object is loaded, it is assigned to the " xmlDocument" property of the user control. To demonstrate how the user control is used, what this WPF application does is to first let the user browse an XML file and load the XML file into a " " object.

.wpd viewer

Private void ClearXmlFile( object sender, RoutedEventArgs e) MessageBox.Show( " The XML file is invalid") Private void BrowseXmlFile( object sender, RoutedEventArgs e) / public partial class XMLViewerDemoApplication : Window / /// Interaction logic for Window1.xaml The code-behind file for " XMLViewerDemoApplication.xaml" is the following: The code-behind file for " Viewer.xaml" is the following: The XML document viewer control is implemented in " Viewer.xaml":Ĭopy Code Text The " XMLViewer" project is a class library to create the XML document viewer control, and the " DemoApplication" project is a WPF application to demonstrate how the control is used. The Visual Studio Solution " XMLViewerDomo" has two. Overview of the Simple Visual Studio Solution The Visual Studio Solution is developed in Visual Studio 2008. One is the user control class library and the other is a simple WPF application to demonstrate how the control is used. The demo Visual Studio Solution that comes with this article has two. What I did is simply make the idea into an easier to use user control, and provide a demo application to show how the control is used. The XML document viewer control introduced in this article is inspired by Marco Zhou's blog. I need an XML document viewer control that displays the XML content in a formatted way, and I will need the control to take the XML content from a " " object, so I can dynamically generate the XML content and display it. I will then need some other alternatives. But when I try to navigate the " WebBrowser" control to an in-memory XML string, the control fails to recognize that the content is XML and the display format is completely wrong. When I navigate the " WebBrowser" control to an XML file on the hard drive or some XML content on the web, it is displayed fine. My first option was to use the WPF " WebBrowser" control. In one of my recent WPF projects, I needed to display some XML documents in a formatted way similar to how Internet Explorer displays them. This article introduces a simple XML document viewer control for WPF applications to display XML documents in a nicely formatted way.












.wpd viewer