Browse Source

Fix namespace prefixes of property elements.

pull/404/head
Vaughan Woodzell 12 years ago
parent
commit
b54be3902f
  1. 7
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs
  2. 13
      ILSpy.BamlDecompiler/Tests/Cases/CustomControl.cs
  3. 12
      ILSpy.BamlDecompiler/Tests/Cases/NamespacePrefix.xaml
  4. 2
      ILSpy.BamlDecompiler/Tests/ILSpy.BamlDecompiler.Tests.csproj
  5. 6
      ILSpy.BamlDecompiler/Tests/TestRunner.cs

7
ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

@ -1667,6 +1667,13 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
|| (elementDeclaration.Type != null && declaration.Type != null && elementDeclaration.Type.IsSubclassOf(declaration.Type))) || (elementDeclaration.Type != null && declaration.Type != null && elementDeclaration.Type.IsSubclassOf(declaration.Type)))
return String.Empty; return String.Empty;
} }
else if (node is XmlBamlPropertyElement)
{
XmlBamlPropertyElement property = (XmlBamlPropertyElement)node;
declaration = property.TypeDeclaration;
if (property.Parent.TypeDeclaration.Type.IsSubclassOf(property.PropertyDeclaration.DeclaringType.Type))
declaration = property.Parent.TypeDeclaration;
}
else if (node is XmlBamlElement) else if (node is XmlBamlElement)
declaration = ((XmlBamlElement)node).TypeDeclaration; declaration = ((XmlBamlElement)node).TypeDeclaration;
else else

13
ILSpy.BamlDecompiler/Tests/Cases/CustomControl.cs

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace ILSpy.BamlDecompiler.Tests.Cases
{
public class CustomControl : Control
{
}
}

12
ILSpy.BamlDecompiler/Tests/Cases/NamespacePrefix.xaml

@ -0,0 +1,12 @@
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:cc="clr-namespace:ILSpy.BamlDecompiler.Tests.Cases">
<Label>
<Label.Style>
<Style />
</Label.Style>
</Label>
<cc:CustomControl>
<cc:CustomControl.Style>
<Style />
</cc:CustomControl.Style>
</cc:CustomControl>
</Grid>

2
ILSpy.BamlDecompiler/Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -74,6 +74,7 @@
<DependentUpon>AttachedEvent.xaml</DependentUpon> <DependentUpon>AttachedEvent.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Cases\CustomControl.cs" />
<Compile Include="Cases\MyControl.xaml.cs"> <Compile Include="Cases\MyControl.xaml.cs">
<DependentUpon>MyControl.xaml</DependentUpon> <DependentUpon>MyControl.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
@ -127,6 +128,7 @@
<Page Include="Cases\AvalonDockCommon.xaml" /> <Page Include="Cases\AvalonDockCommon.xaml" />
<Page Include="Cases\MarkupExtension.xaml" /> <Page Include="Cases\MarkupExtension.xaml" />
<Page Include="Cases\MyControl.xaml" /> <Page Include="Cases\MyControl.xaml" />
<Page Include="Cases\NamespacePrefix.xaml" />
<Page Include="Cases\Resources.xaml" /> <Page Include="Cases\Resources.xaml" />
<Page Include="Cases\Simple.xaml"> <Page Include="Cases\Simple.xaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>

6
ILSpy.BamlDecompiler/Tests/TestRunner.cs

@ -79,6 +79,12 @@ namespace ILSpy.BamlDecompiler.Tests
RunTest("cases/simplepropertyelement"); RunTest("cases/simplepropertyelement");
} }
[Test]
public void NamespacePrefix()
{
RunTest("cases/namespaceprefix");
}
#region RunTest #region RunTest
void RunTest(string name) void RunTest(string name)
{ {

Loading…
Cancel
Save