locked
When does Focus event fired? RRS feed

  • Question

  • User356011 posted

    The official doc says:

    Occurs when the element receives focus.

    for example, what is a focus for a BoxView?

    Monday, September 30, 2019 3:51 PM

Answers

  • User89714 posted

    @mshwf said: The official doc says:

    Occurs when the element receives focus.

    for example, what is a focus for a BoxView?

    Not all Views can receive focus on all (or any) platforms. I would not expect BoxView to receive focus on any platform.

    Some things find themselves in VisualElement even though they are useful in only some derived classes, rather than in all derived classes.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, September 30, 2019 7:45 PM

All replies

  • User365353 posted

    Look at Xamarin sources. Maybe you find something https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/VisualElement.cs#L611 Also check renderers https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.UAP/VisualElementRenderer.cs

    Monday, September 30, 2019 5:15 PM
  • User89714 posted

    @mshwf said: The official doc says:

    Occurs when the element receives focus.

    for example, what is a focus for a BoxView?

    Not all Views can receive focus on all (or any) platforms. I would not expect BoxView to receive focus on any platform.

    Some things find themselves in VisualElement even though they are useful in only some derived classes, rather than in all derived classes.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Monday, September 30, 2019 7:45 PM
  • User356011 posted

    @JohnHardman said:

    @mshwf said: The official doc says:

    Occurs when the element receives focus.

    for example, what is a focus for a BoxView?

    Not all Views can receive focus on all (or any) platforms. I would not expect BoxView to receive focus on any platform.

    Some things find themselves in VisualElement even though they are useful in only some derived classes, rather than in all derived classes.

    So, the Entry and Editor are the only VisualElements that can receive focusing?

    Friday, October 4, 2019 8:55 AM
  • User89714 posted

    @mshwf said: So, the Entry and Editor are the only VisualElements that can receive focusing?

    It depends which platform you are running on. On UWP, any interactive element (e.g. a Button, a CheckBox, a ScrollView etc) can receive focus.

    Friday, October 4, 2019 9:16 AM