Focus Event Args. Try Cancel Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to cancel the ongoing focus action.
public: virtual bool TryCancel() = TryCancel;
public bool TryCancel();
Public Function TryCancel () As Boolean
True, if the focus action is canceled; otherwise, false.
Windows 10, version 1803 (introduced in 10.0.17134.0)
Windows.Foundation.UniversalApiContract (introduced in v6.0)
Apps that target Windows 10, version 1803 or later should use this property instead of Cancel. If your app also supports previous versions, see Version adaptive apps: Use new APIs while maintaining compatibility with previous versions for more info.
GettingFocus and LosingFocus are raised synchronously, while GotFocus and LostFocus are raised asynchronously. For example, if your app calls the Focus method of a control, GettingFocus is raised during the call, but GotFocus is raised after the call completes.
If focus is moved while these events are still bubbling, an exception is thrown.