Skip to content

Commit 246c117

Browse files
committed
Merge pull request #360 from l1pton17/SmartHintDesigner
Fixes #359
2 parents ff48620 + a2a1a63 commit 246c117

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

MaterialDesignThemes.Wpf/SmartHint.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.Linq;
45
using System.Text;
56
using System.Threading.Tasks;
@@ -152,17 +153,28 @@ protected virtual void OnHintProxyIsVisibleChanged(object sender, EventArgs e)
152153

153154
private void RefreshState(bool useTransitions)
154155
{
155-
if (HintProxy == null) return;
156-
if (!HintProxy.IsVisible) return;
156+
var proxy = HintProxy;
157157

158-
Dispatcher.BeginInvoke(new Action(() =>
158+
if (proxy == null) return;
159+
if (!proxy.IsVisible) return;
160+
161+
var action = new Action(() =>
159162
{
160-
var state = string.IsNullOrEmpty((HintProxy.Content ?? "").ToString())
163+
var state = String.IsNullOrEmpty((proxy.Content ?? String.Empty).ToString())
161164
? ContentEmptyName
162165
: ContentNotEmptyName;
163-
166+
164167
VisualStateManager.GoToState(this, state, useTransitions);
165-
}));
168+
});
169+
170+
if (DesignerProperties.GetIsInDesignMode(this))
171+
{
172+
action();
173+
}
174+
else
175+
{
176+
Dispatcher.BeginInvoke(action);
177+
}
166178
}
167179
}
168180
}

0 commit comments

Comments
 (0)