title: Masking to WPF date picker
body: <p>I want to add masking to WPF date picker control. I saw that DatePickerTextBox can not be extended any further.</p>
  
  <p>So, I decided a add a interactivity behavior to it. I used following code for this:</p>
  
  <p>Masked date picker class:</p>
  
  <pre><code>public class MaskedDatePicker : DatePicker
  {
  } 
  </code></pre>
  
  <p>and I created a attached behavior like below:</p>
  
  <pre><code>public class DatePickerTextBoxInputMaskBehavior : Behavior&lt;DatePickerTextBox&gt;
  {
  }
  </code></pre>
  
  <p>Now in templates I attached the behavior:</p>
  
  <pre><code>&lt;DatePickerTextBox x:Name="PART_TextBox"
      Grid.Row="0"
      Grid.Column="0"
      HorizontalContentAlignment="Stretch"
      VerticalContentAlignment="Stretch"
      Focusable="{TemplateBinding Focusable}"
      Foreground="{TemplateBinding Foreground}"&gt;
      &lt;i:Interaction.Behaviors&gt;
          &lt;cleanPoc:DatePickerTextBoxInputMaskBehavior /&gt;
      &lt;/i:Interaction.Behaviors&gt;
  &lt;/DatePickerTextBox&gt;
  </code></pre>
  
  <p>Now every time i open the calender from datepicker application freezes because text changed in DatePickerTextBoxInputMaskBehavior got fired recursively. 
  Any idea how to handle it?</p>