```
```
public MainWindow()
{
InitializeComponent();
this.Loaded += (sender, args) =>
{
// Remove the MapView from the Layout
GridLayout.Children.Remove(MyMapView);
MyMapView.Width = MyMapView.Height = 300;
// Add the MapView to a Fixed Page
var fixedPage = new FixedPage { Width = 300, Height = 300 };
fixedPage.Children.Add(MyMapView);
GridLayout.Children.Remove(listBox);
listBox.Width = listBox.Height = 300;
fixedPage.Children.Add(listBox);
// Add the FixedPage to the PageContent
var pageContent = new PageContent { Child = fixedPage };
// Add the PageContent to the FixedDocument
MyFixedDocument.Pages.Add(pageContent);
};
}
```"/>
获取应用程序中的漏洞更新
URL 已复制共享 URL
漏洞
ArgumentNullException is returned when hosting MapView in Microsoft DocumentView control for client side printing.
Appears to be a bug in FixedDocument. Suggested workaround:
```
Code will move MapView from here and place it in the above DocumentViewer. The user wants to be able to print the map but the application always throws an ArgumentNullException.
```
```
public MainWindow()
{
InitializeComponent();
this.Loaded += (sender, args) =>
{
// Remove the MapView from the Layout
GridLayout.Children.Remove(MyMapView);
MyMapView.Width = MyMapView.Height = 300;
// Add the MapView to a Fixed Page
var fixedPage = new FixedPage { Width = 300, Height = 300 };
fixedPage.Children.Add(MyMapView);
GridLayout.Children.Remove(listBox);
listBox.Width = listBox.Height = 300;
fixedPage.Children.Add(listBox);
// Add the FixedPage to the PageContent
var pageContent = new PageContent { Child = fixedPage };
// Add the PageContent to the FixedDocument
MyFixedDocument.Pages.Add(pageContent);
};
}
```