WPF内置命令

Posted 华天虎

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WPF内置命令相关的知识,希望对你有一定的参考价值。

<Window x:Class="WpfCommands.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <WrapPanel>
 
            <Button Width="100" Height="30" Command="{x:Static ApplicationCommands.Copy}"
                Content="{Binding Path=Command.Text, RelativeSource={RelativeSource Self}}"
                CommandTarget="{Binding ElementName=textBox}" ></Button>
            <Button Width="100" Height="30" Command="Cut"
                Content="{Binding Path=Command.Text, RelativeSource={RelativeSource Self}}"
                CommandTarget="{Binding ElementName=textBox}" ></Button>
            <Button Width="100" Height="30" Command="Paste"
                Content="{Binding Path=Command.Text, RelativeSource={RelativeSource Self}}"
                CommandTarget="{Binding ElementName=textBox}" ></Button>
            <Button Width="100" Height="30" Command="Undo"
                Content="{Binding Path=Command.Text, RelativeSource={RelativeSource Self}}"
                CommandTarget="{Binding ElementName=textBox}" ></Button>
            <Button Width="100" Height="30" Command="Redo"
                Content="{Binding Path=Command.Text, RelativeSource={RelativeSource Self}}"
                CommandTarget="{Binding ElementName=textBox}" ></Button>
        </WrapPanel>
        
        <TextBox Name="textBox" Height="200"></TextBox>
    </StackPanel>
</Window>

以上是关于WPF内置命令的主要内容,如果未能解决你的问题,请参考以下文章

2021-10-02 WPF上位机 53-MVVM模式中的命令

bash内置命令

Bash基础——内置命令

shell简单使用内置命令

查看内置命令和非内置命令帮助的几种方法(manhelpinfo)

如何获得内置命令的内置?