diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/NamespaceTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/NamespaceTests.cs
index 9b622095af..42d41eca2f 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/NamespaceTests.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/NamespaceTests.cs
@@ -1,7 +1,9 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
+using System.Windows;
using System.Windows.Controls;
+
using NUnit.Framework;
namespace ICSharpCode.WpfDesign.Tests.Designer
@@ -105,6 +107,18 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
public class CustomButton : Button
{
+ public static readonly DependencyProperty TestAttachedProperty = DependencyProperty.RegisterAttached("TestAttached", typeof(double), typeof(CustomButton),
+ new FrameworkPropertyMetadata(Double.NaN));
+
+ public static double GetTestAttached(UIElement element)
+ {
+ return (double)element.GetValue(TestAttachedProperty);
+ }
+
+ public static void SetTestAttached(UIElement element, double value)
+ {
+ element.SetValue(TestAttachedProperty, value);
+ }
}
public class CustomCheckBox : CheckBox
@@ -116,6 +130,18 @@ namespace ICSharpCode.WpfDesign.Tests.Controls
{
public class CustomButton : Button
{
+ public static readonly DependencyProperty TestAttachedProperty = DependencyProperty.RegisterAttached("TestAttached", typeof(double), typeof(CustomButton),
+ new FrameworkPropertyMetadata(Double.NaN));
+
+ public static double GetTestAttached(UIElement element)
+ {
+ return (double)element.GetValue(TestAttachedProperty);
+ }
+
+ public static void SetTestAttached(UIElement element, double value)
+ {
+ element.SetValue(TestAttachedProperty, value);
+ }
}
public class CustomCheckBox : CheckBox
@@ -127,6 +153,18 @@ namespace ICSharpCode.WpfDesign.Tests.OtherControls
{
public class CustomButton : Button
{
+ public static readonly DependencyProperty TestAttachedProperty = DependencyProperty.RegisterAttached("TestAttached", typeof(double), typeof(CustomButton),
+ new FrameworkPropertyMetadata(Double.NaN));
+
+ public static double GetTestAttached(UIElement element)
+ {
+ return (double)element.GetValue(TestAttachedProperty);
+ }
+
+ public static void SetTestAttached(UIElement element, double value)
+ {
+ element.SetValue(TestAttachedProperty, value);
+ }
}
public class CustomCheckBox : CheckBox
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs
index c1ad04f4f9..374648181d 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs
@@ -3,6 +3,7 @@
using System;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
@@ -47,5 +48,29 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
button.Properties.GetProperty("Content").SetValue("Hello World!");
AssertCanvasDesignerOutput("", button.Context);
}
+
+ [Test]
+ public void SetAttachedProperties()
+ {
+ DesignItem button = CreateCanvasContext("");
+
+ button.Properties.GetAttachedProperty(Grid.ColumnProperty).SetValue(0);
+ button.Properties.GetAttachedProperty(CustomButton.TestAttachedProperty).SetValue(0);
+ button.Properties.GetAttachedProperty(ICSharpCode.WpfDesign.Tests.Controls.CustomButton.TestAttachedProperty).SetValue(0);
+ button.Properties.GetAttachedProperty(ICSharpCode.WpfDesign.Tests.OtherControls.CustomButton.TestAttachedProperty).SetValue(0);
+
+ AssertCanvasDesignerOutput("",
+ button.Context,
+ "xmlns:sdtcontrols=\"http://sharpdevelop.net/WpfDesign/Tests/Controls\"",
+ "xmlns:Controls0=\"clr-namespace:ICSharpCode.WpfDesign.Tests.OtherControls;assembly=ICSharpCode.WpfDesign.Tests\"");
+ }
+
+ [Test]
+ public void SetInstanceProperty()
+ {
+ DesignItem button = CreateCanvasContext("");
+ button.Properties.GetProperty("Width").SetValue(10);
+ AssertCanvasDesignerOutput("", button.Context);
+ }
}
}