title: Repeatable pattern in WPF
body: <p>I'm trying to achieve quite a specific thing in WPF. I need to create a verifiable control, which will be binded to object of generic class like this</p>
  
  <pre><code>public interface IVerifiable
  {
      bool Verified { get; set; }
  }
  
  public class VerifiableProperty&lt;T&gt; : INotifyPropertyChanged, IVerifiable
  {
      private T _value;
      private bool _verified;
  
      public T Value
      {
          get =&gt; _value;
          set
          {
              if (Equals(value, _value)) return;
              _value = value;
              OnPropertyChanged();
          }
      }
  
      public bool Verified
      {
          get =&gt; _verified;
          set
          {
              if (value == _verified) return;
              _verified = value;
              OnPropertyChanged();
          }
      }
  }
  </code></pre>
  
  <p>I bind controls this way</p>
  
  <pre><code>&lt;TextBox Text="{Binding Path=Number.Value}" att:VerifiableControl.Verified="{Binding Path=Number.Verified}"
                                                   BorderBrush="{Binding Path=(att:VerifiableControl.Verified), Mode=OneWay,
                                                                 Converter={StaticResource BackColorVerifiedConverter}}"&gt;
                                              &lt;inter:Interaction.Triggers&gt;
                                                  &lt;inter:EventTrigger EventName="LostFocus"&gt;
                                                      &lt;inter:InvokeCommandAction Command="{Binding Path=DataContext.VerifyCurrentFieldCommand, ElementName=Root}"
                                                                                 CommandParameter="{Binding Path=Number}"/&gt;
                                                  &lt;/inter:EventTrigger&gt;
                                              &lt;/inter:Interaction.Triggers&gt;
                                          &lt;/TextBox&gt;
  </code></pre>
  
  <p>Generic value of Verifiable property object binds to text (or SelectedDate in case of DatePicker, etc.), border color binds to flag "Verified" via converter and also I bind interaction trigger for "FocusLost" event to ViewModel command that just set "Verified" flag of corresponding property object to true.</p>
  
  <p>I really don't like the idea I have to copypaste this block many times with little changes. I know, I cannot put intercation trigger in style and I also couldn't find another way to make some kind of short pattern for that.
  So, is there a way to create some kind of short pattern for this xaml code where I could customize name of property to bind? Or maybe you could suggest another approach for what I want ot achieve?</p>