Sdílet prostřednictvím


Application Command List

Basically copied this from the link:

https://msdn.microsoft.com/en-us/library/system.windows.input.applicationcommands.aspx

Name

Description

BrowseBack

Gets the value that represents the Browse Back command.

BrowseForward

Gets the value that represents the Browse Forward command.

BrowseHome

Gets the value that represents the Browse Home command.

BrowseStop

Gets the value that represents the Browse Stop command.

DecreaseZoom

Gets the value that represents the Decrease Zoom command.

Favorites

Gets the value that represents the Favorites command.

FirstPage

Gets the value that represents the First Page command.

GoToPage

Gets the value that represents the Go To Page command.

IncreaseZoom

Gets the value that represents the Increase Zoom command.

LastPage

Gets the value that represents the Last Page command.

NavigateJournal

Gets the value that represents the Navigate Journal command.

NextPage

Gets the value that represents the Next Page command.

PreviousPage

Gets the value that represents the Previous Page command.

Refresh

Gets the value that represents the Refresh command.

Search

Gets the value that represents the Search command.

Zoom

Gets the value that represents the Zoom command.

Here is my Aluminum Hat buddy to show you how to use these, scroll down below to see the code!

tinfoil hat, microwave, conspiracy, monster

 

 

 

 

Working XAML Example of using the application commands, some of the application commands require that you use Command Bindings:

You can simply cut and paste all of the code into a WPF Application:

<Window x:Class="CommandBindings.MainWindow"
        xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.CommandBindings>
        <CommandBinding Command="Help" CanExecute="CommandBinding_CanExecute" Executed="CommandBinding_Executed"/>
    </Window.CommandBindings>

        <Grid>
        <Menu VerticalAlignment="Bottom">
            <MenuItem Header="Cut" Command="Cut" CommandTarget="{Binding ElementName=txtBox1}"/>
            <MenuItem Header="Copy" Command="Copy" CommandTarget="{Binding ElementName=txtBox1}"/>
            <MenuItem Header="Paste" Command="Paste" CommandTarget="{Binding ElementName=txtBox1}"/>           
            <MenuItem Header="Help" Command="Help"/>           
        </Menu>
        <TextBox Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="txtBox1" VerticalAlignment="Top" Width="422" />
    </Grid>
</Window>

The code behind that works with the CommandBinding shown above:

using System.Windows;
using System.Windows.Input;

namespace CommandBindings
{

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if (txtBox1!=null && txtBox1.Text.Length>3)
            {
                e.CanExecute = true;
            }
        }

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            MessageBox.Show("ARE YOU HELPLESS");

        }
    }
}