Sharing a Single Style with Heterogeneous Elements

来源:互联网 发布:淘宝p图怎么p 编辑:程序博客网 时间:2024/06/06 11:45

Heterogeneous elements given the same Style.

 

<StackPanel Orientation=”Horizontal”>
<StackPanel.Resources>
<Style x:Key=”controlStyle”>
<Setter Property=”Control.FontSize” Value=”22”/>
<Setter Property=”Control.Background” Value=”Purple”/>
<Setter Property=”Control.Foreground” Value=”White”/>
<Setter Property=”Control.Height” Value=”50”/>
<Setter Property=”Control.Width” Value=”50”/>
<Setter Property=”Control.RenderTransformOrigin” Value=”.5,.5”/>
<Setter Property=”Control.RenderTransform”>
<Setter.Value>
<RotateTransform Angle=”10”/>
</Setter.Value>
</Setter>
</Style>
</StackPanel.Resources>
<Button Style=”{StaticResource controlStyle}”>1</Button>
<ComboBox Style=”{StaticResource controlStyle}”>
<ComboBox.Items>2</ComboBox.Items>
</ComboBox>
<Expander Style=”{StaticResource controlStyle}” Content=”3”/>
<TabControl Style=”{StaticResource controlStyle}”>
<TabControl.Items>4</TabControl.Items>
</TabControl>
<ToolBar Style=”{StaticResource controlStyle}”>
<ToolBar.Items>5</ToolBar.Items>
</ToolBar>
<InkCanvas Style=”{StaticResource controlStyle}”/>
<TextBox Style=”{StaticResource controlStyle}” Text=”7”/>
</StackPanel>

原创粉丝点击