WPF:如何绑定按钮的 IsEnabled 属性

发布于 2024-10-03 12:14:50 字数 158 浏览 0 评论 0原文

使用 WPF 如何将 ButtonIsEnabled 属性绑定到网格的所选行的 DataGridCheckBoxColumn 值?

因此,每次网格的选定行发生更改时,按钮都会根据其中一列的值启用/禁用。

With WPF how can I bind the IsEnabled property of a Button to the selected row's DataGridCheckBoxColumn value of my grid?

So every time the selected row of my grid changes the button will be enabled/disabled depending on the value of one of it's columns.

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

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

发布评论

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

评论(1

策马西风 2024-10-10 12:14:50

该按钮看起来像这样

<Button Content="Update" IsEnabled="{Binding ElementName=grid, Path=SelectedItem.SomeValue}"/>

The button would look something like this

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