WPF BasedOn 自定义样式 例:ComboBox 组合框
自定义样式 ComboBox 组合框
<Window.Resources> <Style x:Key="ComboBox01" TargetType="ComboBox" BasedOn="{StaticResource ComboBoxBaseStyle}"> <Setter Property="BorderBrush" Value="Green"></Setter> <Setter Property="hc:BorderElement.CornerRadius" Value="5"></Setter> </Style> </Window.Resources>
<Grid>
<ComboBox Width="300" Height="30" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="标题在左侧" Style="{StaticResource ComboBox01}" Text="正文1" Margin="210,192,225,209">
<ComboBoxItem>运动</ComboBoxItem>
<ComboBoxItem>唱歌</ComboBoxItem>
<ComboBoxItem>跳舞</ComboBoxItem>
</ComboBox>
</Grid>