wpf combobox的三角形的颜色怎么写

原有的是黑色的,我想改成自己想要的颜色??怎么改?还有就是下拉后选项的颜色怎么写的??... 原有的 是黑色的,我想改成自己想要的 颜色??怎么改?还有就是下拉 后选项的颜色怎么写的?? 展开
 我来答
Lucifer_ABCK
2015-12-14 · TA获得超过230个赞
知道小有建树答主
回答量:107
采纳率:100%
帮助的人:60.3万
展开全部
正好刚写的Combobox的模板,拿着玩吧。。。觉得不满意就重写,没必要纠结于他怎么做。。。默认模板都不够爽。。。只要修改模板中相关控件的颜色即可。。。
<ControlTemplate TargetType="TextBox" x:Key="ComboBox_TextBox">
<Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" BorderBrush="White" BorderThickness="1"/>
</ControlTemplate>
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
<Border Grid.Column="1" Cursor="Hand" BorderBrush="White" BorderThickness="1" Background="#ff00a0a0" Height="21" Width="21">
<Path Data="M 6,7 L 10.5,14 L 15,7 z" Fill="White"/>
</Border>
</ControlTemplate>
<Style TargetType="ComboBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" BorderBrush="White" BorderThickness="1"/>

<ToggleButton Grid.Column="1" Template="{DynamicResource ComboBoxToggleButton}" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
<ContentPresenter HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="ContentSite" VerticalAlignment="Center" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" IsHitTestVisible="False"/>

<TextBox Visibility="Hidden" Template="{DynamicResource ComboBox_TextBox}" HorizontalAlignment="Left" x:Name="PART_EditableTextBox" Style="{x:Null}" VerticalAlignment="Center" Focusable="True" Background="Transparent" IsReadOnly="{TemplateBinding IsReadOnly}"/>

<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide" >
<Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border x:Name="DropDownBorder" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/>
<ScrollViewer Margin="4,6,4,6" Style="{DynamicResource SimpleScrollViewer}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">

<Border BorderBrush="White" BorderThickness="1" >
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="#01000000"/>
</Border>
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式