title: Get active user control name from main window in wpf
body: <p>I am working on to WPF with MVVM pattern and created multiple user control and load it on main window as per need. only one user control is to be loaded on main window at a time. </p>
  
  <p>I want to get the name of active user control from main window.</p>
  
  <pre><code>&lt;Window x:Class="MyApp.Win.UI.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="MainWindowForm" Title="Sample App" WindowState="Maximized" 
      ResizeMode="NoResize" Closed="Window_Closed" KeyDown="Window_KeyDown"        &gt;
   &lt;Grid&gt;
      &lt;StackPanel Name="contentgrid" Panel.ZIndex="1" &gt;
           //Load user controls dynamically as per need 
           // 1 user control is to be load at a time
           // i want to skip background worker on some user control thats why i want to get the active user control name
      &lt;/StackPanel&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>