【wpf】用Button和TextBox实现路由命令的问题

Suneboy 2012-11-27 03:34:05
代码如下:
<StackPanel>
<Menu Width="Auto" Height="20" DockPanel.Dock="Top">
<MenuItem Command="ApplicationCommands.Copy" Header="{Binding Path=Command.Text, RelativeSource={RelativeSource Self}}"/>
</Menu>
<TextBox x:Name="textBoxA"/>
<Button x:Name="buttonA" Command="ApplicationCommands.Copy" Content="{Binding Path=Command.Text,RelativeSource={RelativeSource Self}}"/>
<Button x:Name="buttonB" Command="Paste" Content="{Binding Path=Command.Text,RelativeSource={RelativeSource Self}}"/>
<Button x:Name="buttonC" Command="Redo" Content="{Binding Path=Command.Text,RelativeSource={RelativeSource Self}}"/>
<Button x:Name="buttonD" Command="Undo" Content="{Binding Path=Command.Text,RelativeSource={RelativeSource Self}}"/>
</StackPanel>
提问:为什么使用wpf自带命令,MenuItem正常而 Button始终灰化不可使用?
...全文
87 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Suneboy 2012-12-07
  • 打赏
  • 举报
回复
已了解原理,自己结了吧。

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧