WP8中引用资源字典

  当我们定义的样式太多的时候,我们可以把样式分别定义在不同的文件中,然后通过 MergedDictionaries 应用到其他资源字典中,看下面Demo

 

  我们可以把样式定义在多个文件中,然后再App.xaml中引用

我们先定义三个文件

  1、蓝色按钮资源文件,定义按钮的Foreground为Blue

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="Button">
        <Setter Property="Foreground" Value="Blue"></Setter>
    </Style>
    
</ResourceDictionary>
BlueButtonResource.xaml

相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2021-06-26
  • 2021-11-25
  • 2022-12-23
  • 2022-01-23
  • 2022-01-24
猜你喜欢
  • 2021-07-17
  • 2022-03-06
  • 2021-12-11
  • 2022-01-05
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案