title: Importing converter from dll into XAML
body: <p>I have an EnumToBool Converter class in a dll file MicroMVVM. I want to import and create a resource of this class in XAML of my WPF application. Following is how my declaration in XAML looks like:</p>
  
  <pre><code>&lt;Window x:Class="WpfMVVM.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:sys="clr-namespace:System;assembly=mscorlib"
          xmlns:local="clr-namespace:WpfMVVM"
          xmlns:micro="clr-namespace:MicroMVVM;assembly=MicroMVVM"
          Title="MainWindow" Height="350" Width="525" ContentRendered="Window_ContentRendered"&gt;
      &lt;Window.DataContext&gt;
          &lt;!-- Declaratively create an instance of our SongViewModel --&gt;
          &lt;local:SabrixQAViewModel /&gt;
      &lt;/Window.DataContext&gt;
      &lt;Window.Resources&gt;
          &lt;micro:EnumToBoolExtension x:Key="EnumToBool" /&gt;
      &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>I am getting error in "clr-namespace". The error is "Undefined CLR namespace.The 'clr-namespace' URI refers to a namespace 'MicroMVVM'that is not included in the assembly.</p>
  
  <p>I have added a reference of MicroMVVM.dll in my solution and i am using other classes of the dll in the ViewModel. However, I am getting error while trying to use it in XAML. Please help.</p>
  
  <p>Following is how the Converter class looks inside MicroMVVM:</p>
  
  <pre><code>namespace MicroMvvm
  {
      public enum ValidationMode
      {
          GSS,
          Digital
      }
  
      [ValueConversion(typeof(bool), typeof(Enum))] //This is converting boolean value to a value in Enum
      public class EnumToBoolExtension : MarkupExtension, IValueConverter
      {
          #region IValueConverter
  
          public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
          {
              return parameter.Equals(value);
          }
          public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
          {
              return ((bool)value) == true ? parameter : DependencyProperty.UnsetValue;
          }
  
          #endregion
  
          #region MarkupExtension
  
          public override object ProvideValue(IServiceProvider serviceProvider)
          {
              return this;
          }
  
          #endregion
      }
  }
  </code></pre>