如何删除 WPF 工具栏托盘上的下拉图标?
如何摆脱下面工具栏项中文本右侧的灰色下拉区域?
这是生成它的代码:
ToolBar tb = new ToolBar();
tb.Background = new SolidColorBrush(Colors.Transparent);
Button button = new Button();
button.Content = "test";
button.Click += new RoutedEventHandler(button_Click);
tb.Items.Add(button);
value.ToolBars.Add(tb);
How can I get rid of the grey dropdown area to the right of the text in the toolbar item below?
Here is the code which produces it:
ToolBar tb = new ToolBar();
tb.Background = new SolidColorBrush(Colors.Transparent);
Button button = new Button();
button.Content = "test";
button.Click += new RoutedEventHandler(button_Click);
tb.Items.Add(button);
value.ToolBars.Add(tb);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ToolBar 类中没有属性允许您执行此操作。但您始终可以覆盖 ToolBar 的样式。获取您主题的默认样式。通常该拇指部分称为“OverflowGrid”。只需删除它或将其隐藏即可。
希望能回答您的问题。但我想知道为什么要删除它?您确定需要工具栏控件吗?也许具有适当颜色的原始 ItemsControl 适合您?
There is no property in the ToolBar class which allows you to do this. But you can always override ToolBar's style. Get default style for you theme. Usually that thumb part is called "OverflowGrid". Just remove it or make it hidden.
Hope that answers your question. But I'm wondering why do you want to remove it? Are you sure you need toolbar control there at all? Maybe raw ItemsControl with proper colors will work for you?