title: WPF ValidationRule with dependency property
body: <p>Suppose you have a class inheriting from ValidationRule:</p>
  <pre><code>public class MyValidationRule : ValidationRule
  {
      public string ValidationType { get; set; }
      
      public override ValidationResult Validate(object value, CultureInfo cultureInfo) {}
  }
  </code></pre>
  <p>In XAML you are validating like this:</p>
  <pre><code>&lt;ComboBox.SelectedItem&gt;
      &lt;Binding Path=&quot;MyPath&quot; Mode=&quot;TwoWay&quot; UpdateSourceTrigger=&quot;PropertyChanged&quot; NotifyOnValidationError=&quot;True&quot;&gt;
          &lt;Binding.ValidationRules&gt;
              &lt;qmvalidation:MyValidationRule  ValidationType=&quot;notnull&quot;/&gt;
          &lt;/Binding.ValidationRules&gt;
      &lt;/Binding&gt;
  &lt;/ComboBox.SelectedItem&gt;
  </code></pre>
  <p>Which works and everything is ok.</p>
  <p>But suppose now, you want to have <code>ValidationType=&quot;{Binding MyBinding}&quot;</code> where <code>MyBinding</code> comes from <code>DataContext</code>.</p>
  <p>For this purpose I would need to make <code>MyValidationRule</code> as a <code>DependencyObject</code> and add a <strong>Dependency Property</strong>.</p>
  <p>I've tried to write a class that is <code>DependencyObject</code>, and bind it. There are 2 problems though.. the <code>ValidationRule</code> DOES NOT have the <code>DataContext</code> from the Combobox / Item.</p>
  <p>Do you have any ideas, on how to solve that?</p>