Reputation: 177
I retrieve ControlTemplate of MenuItem through the following standard procedure:
var resource = FindResource(new ComponentResourceKey(typeof(MenuItem), "TopLevelHeaderTemplateKey"));
var settings = new XmlWriterSettings() { Indent = true };
var sb = new StringBuilder();
var writer = XmlWriter.Create(sb, settings);
XamlWriter.Save(resource, writer);
MyTextBox.Text = sb.ToString();
And I wonder, why does in depth of the ControlTemplate I always get:
<Popup IsOpen="False" ...
When the working edition is:
<Popup IsOpen="{TemplateBinding IsSubmenuOpen}" ...
Couldn't found any hardcoded issues through Reflector ILSpy. Why then the standard version of MenuItem is working then? Could someone explain it?
Upvotes: 1
Views: 332
Reputation: 166
I haven't checked it but perhaps it's because you're retrieving template at the run time. Data binding has already been applied to it.
I suggest using Expression Blend to get to the templates of your controls in design time. You'll have all the bindings that are defined there. Just right click on the control and find option like 'Template -> Edit Current'.
Upvotes: 1