cod*_*nix 10 api wpf events frameworks eventargs
我不懂TextCompositionEventArgs类.
有一些名为ControlText,SystemText,Text的字符串成员.然后有一个字段TextConmposistion,它本身又包含成员ControlText,SystemText和Text以及SystemCompositionText和CompositionText字段.
public class TextCompositionEventArgs : InputEventArgs
{
..
public string ControlText { get; }
public string SystemText { get; }
public string Text { get; }
public TextComposition TextComposition { get; }
}
public class TextComposition : DispatcherObject
{
..
public string CompositionText { get; protected set; }
public string ControlText { get; protected set; }
public string SystemCompositionText { get; protected set; }
public string SystemText { get; protected set; }
public string Text { get; protected set; }
}
Run Code Online (Sandbox Code Playgroud)
两个Text成员似乎都包含键盘输入的文本,所有其他字段都包含空字符串.
这些字段以哪种方式不同,它们有什么用?
Ree*_*sey 12
TextCompositionEventArgs在编写文本时处理更改,因此它具有许多处理文本的属性以及具体更改的内容,以及如何使用它取决于您正在处理的事件.
基本要了解的事情:
文本:这包含导致事件的实际文本 - 通常是用户键入的文本
SystemText:这包含系统文本事件,即:如果你按Alt +字母,你会在这里看到事件.这通常是击键,不会像文本框那样影响控件中的文本.
ControlText:这是控制文本事件,即:如果你按Ctrl +字母,你会在这里看到它.与SystemText类似.
通常,如果您只是在寻找标准的"文本"事件,那么您只需要查看"文本"属性即可.有关详细信息,请参阅输入概述.
| 归档时间: |
|
| 查看次数: |
4206 次 |
| 最近记录: |