title: Pass Unity Container to a WPF Converter class
body: <p>I am new to WPF.  </p>
  
  <p>I would like to know how to dependency inject my IUnityContainer class to a ViewModel that has code only in the XAML. </p>
  
  <p><strong>Little Update:</strong><br>
  There is a class named: LiveVideoTileControl - I have added the container to it.</p>
  
  <p>I have windows that has a certain Converter:  </p>
  
  <pre><code>&lt;UserControl x:Class="Driver.Test.Views.LiveVideoTileControl"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           xmlns:ViewModels="clr-namespace:Driver.Test.ViewModel"
           xmlns:Driver="clr-namespace:Driver.Test.DriverRelated"
           mc:Ignorable="d" 
           d:DesignHeight="300" d:DesignWidth="300" &gt;
      &lt;UserControl.Resources&gt;
          &lt;Driver:CameraToMediaElementConverter x:Key="converter"/&gt;
      &lt;/UserControl.Resources&gt;
      &lt;ScrollViewer&gt;
      &lt;Grid&gt;
              &lt;ContentControl Content="{Binding  CameraEntity,Converter={StaticResource converter}}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"&gt;
          &lt;/ContentControl&gt;
      &lt;/Grid&gt;
      &lt;/ScrollViewer&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>How can i inject a container to class "CameraToMediaElementConverter" ?</p>
  
  <pre><code>class CameraToMediaElementConverter : IValueConverter
  {
      public object Convert(object cameraEntity, Type targetType, object parameter, System.Globalization.CultureInfo culture)
      {
          if ((cameraEntity as ICameraEntity) != null)
          {
              return DriverWrapper.GetControlForCamera((ICameraEntity)cameraEntity);
          }
          throw new NotImplementedException();
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>