EditingCommands.SelectLeftByWord 屬性


表示 SelectLeftByWord 命令,這個命令會要求目前的選取範圍向左擴展一個字。Represents the SelectLeftByWord command, which requests that the current selection be expanded left by one word.

 static property System::Windows::Input::RoutedUICommand ^ SelectLeftByWord { System::Windows::Input::RoutedUICommand ^ get(); };
public static System.Windows.Input.RoutedUICommand SelectLeftByWord { get; }
member this.SelectLeftByWord : System.Windows.Input.RoutedUICommand
Public Shared ReadOnly Property SelectLeftByWord As RoutedUICommand


所要求的命令。The requested command. 此命令的預設按鍵手勢為CtrlShift + + LeftThe default key gesture for this command is Ctrl+Shift+Left.


下列範例示範如何在支援命令的物件上叫用編輯命令。The following example demonstrates how to invoke an editing command on an object that supports the command.

RichTextBox此範例中, 會作為命令目標。For this example, a RichTextBox serves as the command target. 請注意, 會執行FrameworkElement介面(繼承自),而且它包含許多編輯命令的原生支援。IInputElement RichTextBoxNote that RichTextBox implements the IInputElement interface (inherited from FrameworkElement), and that it includes native support for many editing commands.

Execute方法的第一個引數是命令參數。The first argument for the Execute method is a command parameter. 大部分的編輯命令都會忽略命令參數;一般而言, 這個參數應該是null用於編輯命令。Most editing commands ignore the command parameter; in general, this parameter should be null for editing commands.

第二個引數會指定要將命令路由傳送至的物件。The second argument specifies the object to which the command will be routed. 這個物件必須執行IInputElement介面, 而且應該包含指定之命令的處理常式。This object must implement the IInputElement interface, and should include a handler for the specified command. 一般而言, 在未處理命令的物件上叫用時, 會忽略命令。Generally, a command is ignored when invoked on an object that does not handle the command.

RichTextBox rTB = new RichTextBox();

EditingCommands.ToggleInsert.Execute(null, rTB);
Dim rTB As New RichTextBox()

EditingCommands.ToggleInsert.Execute(Nothing, rTB)


如果插入號是在單字中, 此命令會將選取範圍展開至該單字的開頭。If the caret is within a word, this command expands the selection to the beginning of that word. 否則, 此命令會將選取範圍展開為上一個字組的開頭。Otherwise, this command expands the selection to the beginning of the previous word.

展開的選取範圍不包含文字分隔符號。The expanded selection does not include the word delimiter. SelectRightByWord比較, 這會在展開的選取範圍中包含文字分隔符號。Contrast with SelectRightByWord, which does include the word delimiter in the expanded selection.

不一定會在任何指定的物件上回應此命令的實際執行;在許多情況下, 回應命令的實作為應用程式寫入器的責任。There is not necessarily an actual implementation that responds to this command on any given object; in many cases the implementation that responds to a command is the responsibility of the application writer.

RichTextBoxTextBox和原本PasswordBox就支援這個命令。This command is natively supported by RichTextBox, TextBox, and PasswordBox.

XAML Attribute UsageXAML Attribute Usage

<object property="SelectLeftByWord"/>