WPF 样式
<Style TargetType="Button">,如果没有更优先的(样式的优先性)样式指定,那么默认所有在Grid中的Button都用这套样式
1 <Grid.Resources>
2 <Style TargetType="Button" x:Key="ButtonStyleBase">
3 <Setter Property="Width" Value=" 300"></Setter>
4 </Style>
5 <Style TargetType="Button" >
6 <Setter Property="Background">
7 <Setter.Value>
8 <LinearGradientBrush StartPoint="0.5,0" EndPoint=" 0.5,1">
9 <GradientStop Color="Orange" Offset="0"/>
10 <GradientStop Color="Aquamarine" Offset="0.5"/>
11 <GradientStop Color="SkyBlue" Offset="1"/>
12 </LinearGradientBrush>
13 </Setter.Value>
14 </Setter>
15 <Setter Property="Width" Value="20"/>
16 <Setter Property="Height" Value="38"/>
17 </Style>
18 <Style TargetType="ComboBox" >
19 <Setter Property="Background">
20 <Setter.Value>
21 <LinearGradientBrush StartPoint="0.5,0" EndPoint=" 0.5,1">
22 <GradientStop Color="Orange" Offset="0"/>
23 <GradientStop Color="Aquamarine" Offset="0.5"/>
24 <GradientStop Color="SkyBlue" Offset="1"/>
25 </LinearGradientBrush>
26 </Setter.Value>
27 </Setter>
28 <Setter Property="Width" Value="20"/>
29 <Setter Property="Height" Value="38"/>
30 </Style>
31 </Grid.Resources>