---
title: "Loading XAML content without new window"  
description: "Loading XAML content without new window"  
author: "Anonymous User"  
published: 2013-09-25  
updated: 2013-09-25  
canonical: https://www.mindstick.com/forum/1525/loading-xaml-content-without-new-window  
category: "wpf"  
tags: ["wpf"]  
reading_time: 2 minutes  

---

# Loading XAML content without new window

I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to find a way to change the [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) of a [window](https://www.mindstick.com/forum/161285/how-does-the-window-console-object-work-in-javascript) in [WPF](https://www.mindstick.com/forum/304/wpf) without having to [load](https://answers.mindstick.com/qa/33737/what-is-meant-by-average-load-time) a new window. In most cases, the following works just fine:

[dim](https://www.mindstick.com/interview/561/what-is-the-difference-between-the-dim-public-and-private-statements) x as new window

x.show()

me.close

Is there a way to do something like the following?

dim x as new window

me.content = x

## Replies

### Reply by Anonymous User

**Hi Chintoo,**

The window I used this in is being used with a barcode scanner. We have a handful of item types that can be scanned with a different set of options and displays needed for each. Since our app is written in the MVVM pattern (Or at least... MVVM-esque ;) ) I created some XAML:

```
<ContentControl Grid.Row="2" Content="{Binding itemOptions}" /> Which is then bound to this property:    Public ReadOnly Property itemOptions As UserControl        Get            Select Case SearchResult.GetType()                ' Part                Case GetType(partHeaderModel)                    Try                        Return New partOptions                    Catch ex As Exception                        ' Fail                        ' Return New noResults                    End Try                    ' Bin                Case GetType(binModel)                    Try                        Return New binOptions                    Catch ex As Exception                        ' Fail                        Return New noResults                    End Try                    ' Rack                Case GetType(rackModel)                    Try                        Return New rackOptions                    Catch ex As Exception                        ' Fail                        Return New noResults                    End Try                Case Else            End Select            Return New noResults        End Get    End Property
```

I have a search function which returns a data model based on the type of item the user scans. Based on the type, the select statement returns the property user control. I use INotifyPropertyChanged along with the scan event to get the window to update.


---

Original Source: https://www.mindstick.com/forum/1525/loading-xaml-content-without-new-window

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
