.NET 4 control default templates without Blend
Asked Answered
D

2

6

How do people find the default templates of .NET controls when they can't use Expression Blend?

So far, when I needed the templates for WPF controls I went to the WPF project page on Codeplex, browsed the source code and usually found the default templates in "Generic.xaml" files.

But now I am looking for the default template for the "Frame" control. I can't find it on Codeplex, and I don't see it either in the .NET framework source provided by MS (XAML files are not provided, only .cs files).

The Style Snooper tool gives a default template but it seems reverse-engineered (unnecessary lengthy and referencing internal classes) rather than being the original clean definition.

So, how do poor people get those templates?

Dirichlet answered 22/8, 2011 at 6:4 Comment(4)
Get expression blend. It is part of your MSDN subscription anyway.Arbalest
When you buy Visual Studio you automatically get an MSDN subscription?Dirichlet
No, but given the price difference it makes little sense to buy visual studio. But a decent MSDN subscription.Arbalest
I am not in charge of buying software in my company but out of curiosity I checked the prices (for Korea, in wons). VS Pro (which I currently use) is at 999,000 and VS Premium with MSDN (which is the minimum version including Expression) is at 7,414,000! The question was about how to develop when you're not rich :)Dirichlet
M
7

1) you can get default template and seriallize it to file.

var resource = Application.Current.FindResource(typeof(Control_Under_Interest));
using (XmlTextWriter writer = new XmlTextWriter(file_name, System.Text.Encoding.UTF8))
{
    writer.Formatting = Formatting.Indented;
    XamlWriter.Save(resource, writer);
}

2) Reflector with Baml Viewer may be used to get resources dictionaries from assemblies.

3) dotPeek 1.1 supports BAML disassembling.

Morpho answered 22/8, 2011 at 9:24 Comment(1)
Thanks Yurec. Solution 1 gives a nice output, more concise and clean than the one of Style Snooper. As for solution 2, Reflector is no longer a free product so I will stick to solution 1.Dirichlet
N
0

here is the link from zebi for .Net4.0.

Nasa answered 22/8, 2011 at 6:27 Comment(1)
Thank you both of you for trying to answer. However I have found these pages before and they merely show examples of styles and templates, not the default ones. On my machine with WinXP SP3 and .NET 4, the default frame navigation UI looks like IE7)Dirichlet

© 2022 - 2024 — McMap. All rights reserved.