Browse Source

Set the IsInDesignMode Property

pull/61/head
jkuehner 13 years ago
parent
commit
f05bf96027
  1. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/CustomInstanceFactory.cs

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/CustomInstanceFactory.cs

@ -2,6 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.ComponentModel;
using System.Windows;
namespace ICSharpCode.WpfDesign.Extensions namespace ICSharpCode.WpfDesign.Extensions
{ {
@ -33,7 +35,11 @@ namespace ICSharpCode.WpfDesign.Extensions
/// </summary> /// </summary>
public virtual object CreateInstance(Type type, params object[] arguments) public virtual object CreateInstance(Type type, params object[] arguments)
{ {
return Activator.CreateInstance(type, arguments); var instance = Activator.CreateInstance(type, arguments);
var uiElement = instance as UIElement;
if (uiElement != null)
DesignerProperties.SetIsInDesignMode(uiElement, true);
return instance;
} }
} }

Loading…
Cancel
Save