Browse Source

Merge branch 'master' of git://github.com/vwoodzell/ILSpy

pull/402/head
Siegfried Pammer 12 years ago
parent
commit
0fc57edcb1
  1. 11
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs
  2. 8
      ILSpy.BamlDecompiler/Tests/Cases/MarkupExtension.xaml
  3. 1
      ILSpy.BamlDecompiler/Tests/ILSpy.BamlDecompiler.Tests.csproj
  4. 6
      ILSpy.BamlDecompiler/Tests/TestRunner.cs

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

@ -1089,13 +1089,20 @@ namespace Ricciolo.StylesExplorer.MarkupReflection @@ -1089,13 +1089,20 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
complexPropertyOpened--;
// this property could be a markup extension
// try to convert it
int elementIndex = nodes.IndexOf(propertyElement.Parent);
int start = nodes.IndexOf(propertyElement) + 1;
IEnumerator<XmlBamlNode> enumerator = nodes.GetEnumerator();
// move enumerator to the start of this property value
for (int i = 0; i < start && enumerator.MoveNext(); i++) ;
// note whether there are any child elements before this one
bool anyChildElement = false;
for (int i = 0; i < start && enumerator.MoveNext(); i++)
{
if (i > elementIndex && i < start - 1 && (enumerator.Current is XmlBamlEndElement))
anyChildElement = true;
}
if (IsExtension(enumerator) && start < nodes.Count - 1) {
if (!anyChildElement && IsExtension(enumerator) && start < nodes.Count - 1) {
start--;
nodes.RemoveAt(start);
nodes.RemoveLast();

8
ILSpy.BamlDecompiler/Tests/Cases/MarkupExtension.xaml

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
<Label xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Label.Style>
<Style />
</Label.Style>
<Label.Content>
<Binding Path="Blah" />
</Label.Content>
</Label>

1
ILSpy.BamlDecompiler/Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -125,6 +125,7 @@ @@ -125,6 +125,7 @@
<Page Include="Cases\AttachedEvent.xaml" />
<Page Include="Cases\AvalonDockBrushes.xaml" />
<Page Include="Cases\AvalonDockCommon.xaml" />
<Page Include="Cases\MarkupExtension.xaml" />
<Page Include="Cases\MyControl.xaml" />
<Page Include="Cases\Resources.xaml" />
<Page Include="Cases\Simple.xaml">

6
ILSpy.BamlDecompiler/Tests/TestRunner.cs

@ -67,6 +67,12 @@ namespace ILSpy.BamlDecompiler.Tests @@ -67,6 +67,12 @@ namespace ILSpy.BamlDecompiler.Tests
RunTest("cases/dictionary1");
}
[Test]
public void MarkupExtension()
{
RunTest("cases/markupextension");
}
#region RunTest
void RunTest(string name)
{

Loading…
Cancel
Save