按钮不覆盖父级的 IsEnabled

发布于 2024-08-26 07:14:08 字数 142 浏览 4 评论 0原文

我有一个自定义控件,当该控件被禁用时,它会显示 tryAgain 按钮。

即使我在 xaml 中或使用触发器显式启用 Button,这种嵌套也会导致按钮被禁用。有没有办法覆盖父控件的IsEnabled

I have a custom control that displays a tryAgain button when the control is disabled.

This nesting is causing the button to become disabled, even if I explicitly enable the Button in xaml or with a trigger. Is there a way to override a parent control's IsEnabled?

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

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

发布评论

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

评论(1

ら栖息 2024-09-02 07:14:08

该按钮不能是禁用的父级的子级。尝试这样的事情:

<Grid>
    <CustomControl IsEnabled="False">
    </CustomControl>
    <Button Content="TryAgain"/>
</Grid>

The button can't be a child of the whatever parent is disabled. Try something like this:

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