首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

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

2012-12-16 
【wpf】用Button和TextBox实现路由命令的问题代码如下:StackPanelMenu WidthAuto Height20 DockPan

【wpf】用Button和TextBox实现路由命令的问题
代码如下:
<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始终灰化不可使用?

[解决办法]
已了解原理,自己结了吧。

热点排行