diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r-- | Xamarin.PropertyEditing.Windows/TextBoxEx.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Xamarin.PropertyEditing.Windows/TextBoxEx.cs b/Xamarin.PropertyEditing.Windows/TextBoxEx.cs index 867021c..295ea32 100644 --- a/Xamarin.PropertyEditing.Windows/TextBoxEx.cs +++ b/Xamarin.PropertyEditing.Windows/TextBoxEx.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -71,10 +72,14 @@ namespace Xamarin.PropertyEditing.Windows public override void OnApplyTemplate () { base.OnApplyTemplate (); - + var clear = GetTemplateChild ("PART_Clear") as Button; - if (clear == null) - throw new InvalidOperationException ("PART_Clear must be present as a button"); + if (clear == null) { + if (!DesignerProperties.GetIsInDesignMode (this)) + throw new InvalidOperationException ("PART_Clear must be present as a button"); + + return; + } clear.Click += (sender, e) => { Clear(); |