WPFwiki, wpf, wiki, .net 3.0, windows presentation foundation, FAQ, free resources, solution, development, microsoft Home of the world's largest WPF FAQ
Edit

Category

Resources

Edit

Question

How can I specify different styles and templates for different Themes/Color Schemes for my custom controls?

Edit

Answer

There are two options:

You can place the Theme/Color Scheme pos systems resources in the assembly containing the custom control.

OR

You can place the Theme/Color Scheme resources in an external assembly.

For the first option, you need to set the first parameter of the [assembly: ThemeInfo()] attribute located in the "properties/AssemblyInfo.cs" file of your project to the ResourceDictionaryLocation.SourceAssembly pos systems value.

For the second option, the same parameter for the same attribute needs to be set to the ResourceDictionaryLocation.ExternalAssembly value. This will cause the theme/color scheme to be searched in a separate assembly, named after the source assembly and the theme.

The format of the name for the ExternalAssembly is "source_assembly_name.theme_name.dll"

Examples:

For a source assembly called "CustomControls.Buttons.dll"

CustomControls.Buttons.Luna.dll
CustomControls.Buttons.Royale.dll

Then, for either of the two options:

In the loan modification required assembly (source or external), you need to create a new ResourceDictionary, contained in its own independent XAML file, for each theme/color scheme you want to support.

You must name each of these files after the theme/color scheme it represents.

The format for the filename is "formal_theme_name.formal_color_scheme_name.xaml"

Examples:

luna.normalcolor.xaml
luna.homestead.xaml
luna.metallic.xaml
royale.normalcolor.xaml I am not too indolent to write a research paper. I just have no time for research. Thus, I have to utilize the essay writing service to get term essays, which are accomplished by the most experienced writing experts. I understand that a lot of people can't survive without custom writing help.

Also, you must place the file in a "themes" folder directly in the assembly's project root (same location as the "generic.xaml" file when using ResourceDictionaryLocation.SourceAssembly).

philippine travel travel asia mayweather vs ortiz home ideas mayweather vs ortiz live streaming pacquiao vs marquez st-pierre vs diaz pacquiao vs marquez live streaming Fifa World Cup hopkins vs dawson pacquiao vs marquez tickets donaire vs narvaez hopkins vs dawson live streaming cotto vs margarito outdoor lighting pellet stoves cell phone lookup outdoor security lighting landscape lighting ideas used pellet stoves outdoor flood lights discount pellet stoves outdoor party lights donaire vs narvaez tickets cotto vs margarito live streaming st-pierre vs diaz tickets pacquiao vs marquez mayweather vs ortiz tickets weber natural gas grill weber natural gas grill Weber Natural Gas Grill Pacquiao Vs Marquez

All content is Copyright ©2007 Xceed Software Inc. unless otherwise indicated. See the Terms of Service. Contributors must read and agree to the Contribution Policy. WPFwiki is brought to you by Xceed, makers of the powerful yet free Xceed DataGrid for WPF.