如何将复杂的BAML反编译为有效的XAML

5

我尝试了 ILSpy,但它失败了:


System.NotImplementedException: StaticResourceStart
   в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.ProcessNext()
   в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.ReadInternal()
   в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.Read()
   в System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   в System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   в System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   в ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadIntoDocument(IAssemblyResolver resolver, AssemblyDefinition asm, Stream stream)
   в ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadBaml(AvalonEditTextOutput output)
   в ILSpy.BamlDecompiler.BamlResourceEntryNode.<>c__DisplayClass3.<View>b__1()

我尝试了.Net Reflector的Baml Viewer,但它无法生成有效的XAML。

主要问题出在引用错误的StaticResource的绑定上。

例如(namedViews是CollectionViewSource):

   Visibility="{Binding Path=Value, Converter={StaticResource namedViews}}"
   ToolTip="{StaticResource namedViews}"

有哪些其他应用程序可以反编译BAML?BAML Viewer有任何补丁吗?

1
我刚使用了 ILSpy版本6.0.0.5559-preview2 打开了一个WPF程序集,并且它可以毫无问题地从baml生成XAML。 - Brian THOMAS
1个回答

6

不确定这是否能帮到你,但如果你可以运行应用程序,你可以使用Snoop来查看WPF应用程序的结构。

其他选项:

我只尝试过Snoop,并非常喜欢它,但似乎没有解决你的问题。


我可以在Snoop中查看ToolBarTrayControl,但是Ribbon没有显示。 - Quiz
哦,你的问题中没有提到ToolBarTrayControl或Ribbon。我认为你应该再详细说明一下。你是想找到使用错误的静态资源绑定吗?你也可以尝试使用JetBrains的dotPeek。 - Peter
基于BAML Viewer的dotPeek插件适用于Reflector,是的问题是一样的。 JustDecompile目前不支持BAML功能(http://justdecompile.uservoice.com/forums/113277-justdecompile-feature-suggestions/suggestions/1893781-styles-explorer-baml-decompiler-and-codeviewer-f)。 Woodstock需要完全信任。 - Quiz
抱歉,我已经没有更多的想法了 :( - Peter

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接