组合框控件模板下拉按钮
我想知道是否有人有一个示例,说明如何设置组合框的样式/模板以仅在默认初始状态下显示按钮。有点像功能区栏的 DropDownButton 库。我只希望用户能够单击按钮并列出组合框项目。做出选择后,它不会将所选项目保存在文本字段中,因为没有文本字段,只有一个按钮。谢谢 :)
I was wondering if anyone had an example of how to style/template a combobox to only show a button at its default initial state. Kind of like the DropDownButton gallery for the ribbon bar. I would just like the user to be able to click a button and have the combobox items listed. When the selection is made it does not save the selected item in the text field because there is no text field only a button. Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一些示例代码:
请注意,ContentPresenter 和 PART_EditableTextBox 已被故意注释掉,可以将它们从模板中删除。
此外,您可能想要自定义切换按钮和弹出窗口的外观。
代码改编自:通过创建 ControlTemplate 自定义现有控件的外观
Here's some sample code:
Note that the ContentPresenter and PART_EditableTextBox have been commented out deliberately and they can be taken off from the template.
Also, you may want to customize the appearance of togglebutton and the popup.
Code adapted from: Customizing the Appearance of an Existing Control by Creating a ControlTemplate