停止突出显示所选项目 WPF ComboBox
我目前正在开发 WPF UI,窗口上有一个组合框。 所以我希望用户能够从此组合框中选择一个项目,但是当它被选择时 我不希望它以默认的蓝色突出显示。
我认为 XAML 中有某种方法可以阻止此问题,但到目前为止我还没有找到解决方案。
谢谢。
PS我无权访问Expression Blend,所以如果有人提出解决方案,可以在XAML中
编辑:只是为了更清楚,我选择的意思是一旦您选择了一个值并且SelectionChanged事件已触发并且该项目被显示在组合框中,组合框突出显示如下:
I'm currently working on a WPF UI and I have a combobox on my window.
So I want the user to be able to select an item from this combobox but when it is selected
I don't want it to be highlighted in the default blue colour.
I assume there is some way to stop this in XAML but I have not been able to find the solution so far.
Thanks.
P.S. I don't have access to Expression Blend so if anyone suggests a solution could it be in XAML
EDIT: Just to make it clearer I by selected I mean once you have selected a value and the SelectionChanged event has fired and the item is displayed in the combobox and the combo box is highlighted like so:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要通过样式设置选择的外观。
此样式将自动应用于窗口内的任何组合框:
您将看到如下所示:
UPD:为了删除所选项目的突出显示,您需要修改实际用于这些目的的系统画笔。只需添加两个额外的样式:
You need to set appearance of your selection via styles.
This style will be automatically applied to any ComboBoxes within the window:
You will see it as follows:
UPD: In order to remove highlighting from selected item you need to modify system brushes which are actually used for these purposes. Just add two extra styles:
您是否尝试仅设置 ComboBox.Background 属性?
Did you try to just set the ComboBox.Background property ?