开发者

Default MenuItem TopLevelHeader Control Template

开发者 https://www.devze.com 2023-02-01 19:43 出处:网络
Where can I get the MenuItem TopLevelHeader Control Template? The MSDN link for styling menu items gives a modified template.

Where can I get the MenuItem TopLevelHeader Control Template? The MSDN link for styling menu items gives a modified template.

Default MenuItem TopLevelHeader Control Template

I need to obtain a cont开发者_C百科rol template that contains a default pop-up/context menu.


Manny tools are available that will serve the purpose like stylesnooper and Show Me The Template

but if you have Microsoft Expression Blend you can extract the default control template by

  1. Draggint the control onto the design surface
  2. Right click the control and choose Edit Template -> Edit Copy

When you do this, Blend will extract the base template from the control and explicitly declare it within document/application as a resource which you can then edit to your liking.

Check this for more

http://www.shafqatahmed.com/2009/01/wpf-kid-stuff-extracting-a-control-template.html


I could not get Blend or the usual tools to access that control template but you can extract it yourself with code like the following:

var controlTemplate = (ControlTemplate)FindResource(MenuItem.TopLevelHeaderTemplateKey);
var sb = new StringBuilder();
var xml = XmlWriter.Create(sb, new XmlWriterSettings { Indent = true, NewLineOnAttributes = true });
XamlWriter.Save(controlTemplate, xml);
var xaml = sb.ToString();
Debug.WriteLine(xaml);

The output is too long to include here.

0

精彩评论

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