Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find Generic.xaml for native WPF controls?

Tags:

styles

wpf

Where to find Generic.xaml (or other code with the default look) for native WPF controls such as Button, CheckBox, TextBox, etc?

like image 823
Gus Cavalcanti Avatar asked Nov 02 '09 17:11

Gus Cavalcanti


People also ask

Where is generic xaml?

xaml is available in the \(Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic folder from a Windows Software Development Kit (SDK) installation.

What is generic xaml?

xaml. If the style is not found in the theme dictionary, it looks in Generic. xaml i.e for controls whose look doesn't depend on the theme. This only applies to any custom controls you have defined i.e. classes derived from Control, directly or indirectly.


2 Answers

In Silverlight (and I know that your question is about WPF) this information is more accessible than in WPF. You can get this information from any of these sources:

  1. Control Styles and Templates on MSDN.

  2. You can look at the resources of the relevant Silverlight assembly and extract the themes/generic.xaml embedded in a resource. I use Reflector to do this.

  3. You can extract the control template of a specific control using a tool. I use Expression Blend to do this. This also works for WPF.

like image 117
Martin Liversage Avatar answered Oct 12 '22 18:10

Martin Liversage


Unfortunately the XAML for native controls is not directly available as a file. You need to use a program for peeking into the WPF assemblies and extracting that info. I personally have used the Mole for Visual Studio tool, which has done the job very well. It integrates as a debugger-visualiser, which is quite handy.

like image 36
Noldorin Avatar answered Oct 12 '22 18:10

Noldorin