How to bind ViewModel Property to the dependency property in the convertor
<pre><code>&lt;Window.Resources&gt;
    &lt;local:WeightConverter x:Key="weightConverter" RequiredUnit="{Binding VmProp}" /&gt; 
</code></pre>

<p></p>

<pre><code> &lt;TextBlock Text="{Binding Weight, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource weightConverter}}" /&gt;



public MainWindow()
    {
        InitializeComponent();
        DataContext = new MyViewModel();
</code></pre>

<p>In the MyViewModel I have regular property</p>

<pre><code>    private string vmProp;

    public string VmProp
    {
        get
        {
            return "kg";
        }
    }
</code></pre>

<p>And Convertor class has DependencyProperty is:</p>

<pre><code> public class WeightConverter : DependencyObject, IValueConverter
{
    public static readonly DependencyProperty RequiredUnitProperty = DependencyProperty.Register("RequiredUnit", typeof(string), typeof(WeightConverter), null);
    public string RequiredUnit
    {
        get
        {
            return (string)this.GetValue(RequiredUnitProperty);
        }

        set
        {
            this.SetValue(RequiredUnitProperty, value);
        }
    }


    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
                   double dblValue;

        if (double.TryParse(value.ToString(), out dblValue))
        {
            if (this.RequiredUnit == "kg")
            {
                return dblValue;
            }

            else
            {
                return dblValue * 10;
            }

            return dblValue;
        }

        return 0;
    }
</code></pre>

<p>When I do binding in XAML the code works:</p>

<pre><code>    &lt;Window.Resources&gt;
    &lt;local:WeightConverter x:Key="weightConverter" RequiredUnit="kg"/&gt;  
</code></pre>

<p></p>

<p>But when I try to bind it to ViewModelProperty the 'RequiredUnit' object is always null.</p>

<p>How can I bind dependency property to ViewModel property?</p>