|
|
|
@ -668,6 +668,11 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
@@ -668,6 +668,11 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AddNativeTypeAsResource(object component, string expectedXamlValue) |
|
|
|
|
{ |
|
|
|
|
AddTypeAsResource(component, expectedXamlValue, "Controls0:", new string[] { "xmlns:Controls0=\"clr-namespace:System;assembly=mscorlib\""} ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AddTypeAsResource(object component, string expectedXamlValue, string typePrefix, String[] additionalXmlns) |
|
|
|
|
{ |
|
|
|
|
DesignItem textBlock = CreateCanvasContext("<TextBlock/>"); |
|
|
|
|
DesignItem canvas = textBlock.Parent; |
|
|
|
@ -687,11 +692,11 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
@@ -687,11 +692,11 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
|
|
|
|
|
string typeName = component.GetType().Name; |
|
|
|
|
|
|
|
|
|
string expectedXaml = "<Canvas.Resources>\n" + |
|
|
|
|
" <Controls0:" + typeName + " x:Key=\"res1\">" + expectedXamlValue + "</Controls0:" + typeName + ">\n" + |
|
|
|
|
" <" + typePrefix + typeName + " x:Key=\"res1\">" + expectedXamlValue + "</" + typePrefix + typeName + ">\n" + |
|
|
|
|
"</Canvas.Resources>\n" + |
|
|
|
|
"<TextBlock Tag=\"{StaticResource ResourceKey=res1}\" />"; |
|
|
|
|
|
|
|
|
|
AssertCanvasDesignerOutput(expectedXaml, textBlock.Context, "xmlns:Controls0=\"clr-namespace:System;assembly=mscorlib\""); |
|
|
|
|
AssertCanvasDesignerOutput(expectedXaml, textBlock.Context, additionalXmlns); |
|
|
|
|
AssertLog(""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -736,6 +741,18 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
@@ -736,6 +741,18 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
|
|
|
|
|
const int i = 123; |
|
|
|
|
AddNativeTypeAsResource(i, "123"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void AddWpfEnumAsResource() |
|
|
|
|
{ |
|
|
|
|
AddTypeAsResource(VerticalAlignment.Center, "Center", "", new string[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void AddCustomEnumAsResource() |
|
|
|
|
{ |
|
|
|
|
AddTypeAsResource(MyEnum.One, "One", "t:", new string[0]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public class MyMultiConverter : IMultiValueConverter |
|
|
|
@ -760,4 +777,9 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
@@ -760,4 +777,9 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
|
|
|
|
|
set { stringProp = value; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public enum MyEnum |
|
|
|
|
{ |
|
|
|
|
One, Two |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|