uwpfocustextblocklostfocus

[UWP][C#] GotFocus and LostFocus events of TextBlock is not raised either by tab pressing or by mouse click


I want to perform some action on GotFocus and LostFocus events of a TextBlock but it is not raised by clicking on through mouse or by tab navigation. I want to raise these events on both of the input methods.

Could you please let me know how to do so.

Any help would be greatly appreciated!!!


Solution

  • TextBlock is not is not focusable control. Tab navigation will work only if control is focusable. We can use Tap event. Alternately We can create button style to match our requirements. Button is focusable control.