Styles in Windows Phone

时间:2022-10-12 22:24:53

1. Use resources in internal style file:

<Application.Resources>
    <ResourceDictionary Source="MyResources.xaml" />
</Application.Resources>

2. Use external style file:

<Application.Resources>
    <ResourceDictionary Source="/MyExternalAssembly;component/MyResources.xaml" />
</Application.Resources>

3. Use multiple style files:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Styles/Style1.xaml"/>
            <ResourceDictionary Source="/Styles/Style2.xaml"/>
            <ResourceDictionary Source="/MyExternalAssembly;component/MyResources.xaml" />
        </ResourceDictionary.MergedDictionaries>
        <Style TargetType="Button">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="FontSize" Value="28"/>
        </Style>
    </ResourceDictionary>
</Application.Resources>