工具栏中的组合框表现不同

发布于 2024-12-17 09:38:27 字数 343 浏览 2 评论 0原文

这个线程开始一个新问题,任何人都可以回答为什么< code>ComboBox 和 CheckBoxes 在工具栏内部和外部的行为会有所不同吗?

链接问题的摘要:

我注意到当组合框放置在工具栏中时,行为存在差异。当不在工具栏中时,它的行为符合预期:复选框更改状态而不关闭弹出窗口。但在工具栏中,无论单击位置如何,第一次单击时弹出窗口都会关闭。请尝试新的代码。我真的需要在工具栏中使用它。

Starting a new question from this thread, Can anyone answer why a ComboBox with CheckBoxes would behave differently inside and outside of a toolbar?

Summary from linked question:

I noticed that there is a difference of behavior when the ComboBox is placed in a Toolbar. When not in the Toolbar, it behaves as expected: the CheckBox changes state without closing the Popup. But in the ToolBar, the Popup closes on the first click, regardless of where the click is. Try the new code, please. I really need this in a toolbar.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

弥繁 2024-12-24 09:38:27

我要感谢 jberger 建议我去 MS。

正如 MS 建议的,解决方案是在模板中将CheckBox.Focusable属性设置为False

    <DataTemplate DataType="MyDataClass">
        <CheckBox Focusable="False" ... />
        <TextBlock ... />
    </DataTemplate>

ComboBox位于ToolBar中或仅浮动在某些Panel中时,这提供了所需的行为。

I'd like to thank jberger for suggesting I go to MS.

As suggested by MS, the solution is to set the CheckBox.Focusable property to False in the template.

    <DataTemplate DataType="MyDataClass">
        <CheckBox Focusable="False" ... />
        <TextBlock ... />
    </DataTemplate>

This provides the desired behavior when the ComboBox is either in a ToolBar or just floating in some Panel.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文