Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Maupin <ermaup@microsoft.com>2018-06-28 20:13:10 +0300
committerEric Maupin <ermaup@microsoft.com>2018-07-19 00:20:56 +0300
commita2e13f010fbfde27faf10c071663acdf5a12ed03 (patch)
treea10b8fd771d29a862f0124b6f23195e48def7e60 /Xamarin.PropertyEditing.Windows
parent05bdfa2bc419204afef8005b997e903a8373fb5a (diff)
[Win] Don't throw on missing components in design mode
Because the template is a dynamic load, the parts are missing. We shouldn't throw while in design mode in this case since it just mucks up the designer.
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r--Xamarin.PropertyEditing.Windows/TextBoxEx.cs11
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();