Compartir a través de


IXRUIElement::AddGotFocusEventHandler (Compact 2013)

3/28/2014

This method attaches a delegate to the GotFocus event for this UI element. When the UI element raises the GotFocus event, this delegate will be invoked.

Syntax

virtual HRESULT STDMETHODCALLTYPE AddGotFocusEventHandler(
    IXRDelegate<XRRoutedEventArgs> *pDelegate
)= 0;

Parameters

  • pDelegate
    [in] The IXRDelegate<ArgType, [SenderType]> object that you want to attach to the GotFocus event, which is raised when this element receives UI focus.

    The CreateDelegate function provides an easy way to create this IXRDelegate object.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

Multiple delegates can be attached to the same event.

To remove this delegate from the GotFocus event, call IXRUIElement::RemoveGotFocusEventHandler.

Note

During application initialization, the XAML Runtime (XR) sets focus to the first focusable element in the visual tree. However, the GotFocus event is not triggered in this case unless you explicitly call IXRControl::Focus in the initialization procedure.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h,
XRDelegate.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRUIElement
XRRoutedEventArgs