2 changed files with 42 additions and 0 deletions
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
// 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.Data; |
||||
using System.Windows.Markup; |
||||
|
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Tests.Designer |
||||
{ |
||||
[TestFixture] |
||||
public class SetPropertyTests : ModelTestHelper |
||||
{ |
||||
[Test] |
||||
public void SetContentToBinding() |
||||
{ |
||||
DesignItem button = CreateCanvasContext("<Button Width='100' Height='200'/>"); |
||||
button.Properties.GetProperty("Content").SetValue(new Binding()); |
||||
AssertCanvasDesignerOutput("<Button Width=\"100\" Height=\"200\" Content=\"{Binding}\" />", button.Context); |
||||
} |
||||
|
||||
[Test, Ignore("Properties are not present in XAML DOM")] |
||||
public void SetContentToStaticResource() |
||||
{ |
||||
DesignItem button = CreateCanvasContext(@"<Button Width='100' Height='200'/>"); |
||||
button.Properties.GetProperty("Content").SetValue(new StaticResourceExtension("MyBrush")); |
||||
// TODO : maybe we should support positional arguments from ctors as well => {StaticResource MyBrush}?
|
||||
AssertCanvasDesignerOutput("<Button Width=\"100\" Height=\"200\" Content=\"{StaticResource ResourceKey=MyBrush}\" />", button.Context); |
||||
} |
||||
|
||||
[Test, Ignore("x-Namespace is not resolved properly and properties are not present in XAML DOM")] |
||||
public void SetContentToXStatic() |
||||
{ |
||||
DesignItem button = CreateCanvasContext("<Button Width='100' Height='200'/>"); |
||||
button.Properties.GetProperty("Content").SetValue(new StaticExtension("Button.ClickModeProperty")); |
||||
AssertCanvasDesignerOutput("<Button Width=\"100\" Height=\"200\" Content=\"{x:Static Member=Button.ClickModeProperty}\" />", button.Context); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue