Skip to content

Commit

Permalink
Add OnDetaching to DatePickerTextBoxBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmairegger committed May 31, 2016
1 parent 6f0c7aa commit 6fc8c35
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MahApps.Metro/Behaviours/DatePickerTextBoxBehavior.cs
Expand Up @@ -13,6 +13,12 @@ protected override void OnAttached()
AssociatedObject.TextChanged += OnTextChanged;
}

protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.TextChanged -= OnTextChanged;
}

private void OnTextChanged(object sender, TextChangedEventArgs e)
{
AssociatedObject.TemplatedParent.SetValue(TextBoxHelper.HasTextProperty, AssociatedObject.Text.Length > 0);
Expand Down

0 comments on commit 6fc8c35

Please sign in to comment.