locked
General questions about Templates RRS feed

  • Question

  • Hi,

    besides my other questions that arose while researching for an upcoming project, I have some questions about Templates:

    1. Where should Templates for controls be deposited?

    2. Generic.XAML holds a basis-Template, but where are the others?

    Thanks in advance


    Chris

    Thursday, March 31, 2011 11:02 AM

Answers

  • App.xaml is the central place to define Styles and Templates but it also good practice to put Styles in separate XAML files and then merge them into App.xaml so they become availaible globally.

    e.g.

    <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 ....
                 >
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Assets/Styles.xaml"/>
                    <ResourceDictionary Source="Assets/CoreStyles.xaml"/>
                    <ResourceDictionary Source="Assets/SDKStyles.xaml"/>
                    <ResourceDictionary Source="Assets/ToolkitStyles.xaml"/>
            </ResourceDictionary>
        </Application.Resources>
    </Application>


     

    Thursday, March 31, 2011 11:29 PM

All replies

  • App.xaml is the central place to define Styles and Templates but it also good practice to put Styles in separate XAML files and then merge them into App.xaml so they become availaible globally.

    e.g.

    <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 ....
                 >
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Assets/Styles.xaml"/>
                    <ResourceDictionary Source="Assets/CoreStyles.xaml"/>
                    <ResourceDictionary Source="Assets/SDKStyles.xaml"/>
                    <ResourceDictionary Source="Assets/ToolkitStyles.xaml"/>
            </ResourceDictionary>
        </Application.Resources>
    </Application>


     

    Thursday, March 31, 2011 11:29 PM
  • Thanks for that nice example!
    I think we'll go with this solution.

    Friday, April 1, 2011 4:57 AM
  • If it is want you whant then don't forget to mark my post as answer. Wink

    Friday, April 1, 2011 11:08 AM