开发者

Reverse engineer a ControlTemplate

开发者 https://www.devze.com 2023-03-24 08:59 出处:网络
Windows Workflow Foundation 4 contains a WPF property grid similar to the one a开发者_Go百科vailable for Winforms. The toolbar up the top has a CLEAR button rather than the X shown by Visual Studio. T

Windows Workflow Foundation 4 contains a WPF property grid similar to the one a开发者_Go百科vailable for Winforms. The toolbar up the top has a CLEAR button rather than the X shown by Visual Studio. This control has a ControlTemplate property that is not null at runtime. The template makes use of various glyphs for toolbar buttons.

Are there any tools or techniques that will allow me to extract this template? I would like to examine and modify the XAML to restyle the toolbar (mostly just change the button label).

I have programmatic access to the template object but I'm not sure how to serialize this into XAML.


Have you tried simply using XamlWriter.Save?

e.g.

var template = control.Template;
using (var stream = new FileStream("template.xaml", FileMode.Create))
{
    using (var writer = XmlWriter.Create(stream, new XmlWriterSettings() { Indent = true }))
    {
        XamlWriter.Save(template, writer);
    }
}


have you tried Red Gate's Reflector? Of course, if the assembly is obfuscated it may not really be of much help.

0

精彩评论

暂无评论...
验证码 换一张
取 消