Built-In Command Bindings : Command « Windows Presentation Foundation « C# / C Sharp






Built-In Command Bindings

Built-In Command Bindings
       


<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                Orientation="Horizontal" Height="25">
      <Button Command="Cut" CommandTarget="{Binding ElementName=textBox}"
        Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
      <Button Command="Copy" CommandTarget="{Binding ElementName=textBox}"
        Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
      <Button Command="Paste" CommandTarget="{Binding ElementName=textBox}"
        Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
      <Button Command="Undo" CommandTarget="{Binding ElementName=textBox}"
        Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
      <Button Command="Redo" CommandTarget="{Binding ElementName=textBox}"
        Content="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"/>
      <TextBox x:Name="textBox" Width="200"/>
    </StackPanel>
    

</Page>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Help commandHelp command
2.Button CommandTarget BindingButton CommandTarget Binding
3.Creating CommandBinding and attaching an Executed and CanExecute handlerCreating CommandBinding and attaching an Executed and CanExecute handler
4.Creating a KeyBinding between the Open command and Ctrl-RCreating a KeyBinding between the Open command and Ctrl-R
5.Command Handler Command Binding in XamlCommand Handler Command Binding in Xaml
6.Command Handler Key BindingCommand Handler Key Binding
7.Bind the Button to a CommandBind the Button to a Command
8.Command EnablingCommand Enabling
9.Using CommandBinding and ExecutedRoutedEventHandler to bind Application event to an event handler methodUsing CommandBinding and ExecutedRoutedEventHandler to bind Application event to an event handler method
10.Create CommandBindings in Xaml and bind to ButtonCreate CommandBindings in Xaml and bind to Button
11.Bind TextBox save command to CommandBindingBind TextBox save command to CommandBinding
12.Use TextBox.CommandBindingst to bind commandUse TextBox.CommandBindingst to bind command
13.Parse command line arguments and make them available to an application.
14.Handle a Button Click with Shared button click handlerHandle a Button Click with Shared button click handler