locked
MasterDetailPage - Set focus to entry on Detail page RRS feed

  • Question

  • User230821 posted

    Hi!

    I have a strange issue when trying to set focus to one of the entries on the Detail page.

    I set a new Detail page for MasterDetail mainPage.Detail = new NavigationPage(targetPage); and on Detail page I use OnAppearing() to set focus to entry var result = SomeEntryThatIWantToFocus.Focus(); But this does not work for some reason. Result will equal false and entry is not focused. If I return from next page in navigation stack back to this one, entry will be focused!

    Setting focus on other pages works as expected.

    Any ideas? Help would be greatly appreciated.

    Wednesday, July 13, 2016 2:31 PM

All replies

  • User76916 posted

    @MetodB - is this just an issue with a particular platform or multiple platforms. When you come back and it is focused, is it running through OnAppearing again and this time it returns true?

    (PS: Please tag me in @AdamP, otherwise I might miss you reply)

    Monday, July 18, 2016 1:25 AM
  • User230821 posted

    @AdamP Thank you for your reply.

    When you come back and it is focused, is it running through OnAppearing again and this time it returns true? Yes. When you return, it runs through OnAppearing again and focus is successfully set. Returning value of Focus() is true.

    Currently the only added platform is Android. So I can not test on other platforms. But is looks like this is not related to Android version, it happens on 6.0 and on older versions of Android as well.

    Monday, July 18, 2016 7:27 AM
  • User212383 posted

    Bump, having a similar issue where I just cannot set the focus to the tableView containing an entrycell on load, however, once user taps into the entry field to focus it, behaviour then works correctly? - Not sure why if anyone here knows?

    Friday, October 14, 2016 9:27 AM
  • User397870 posted

    Bump. This is still an issue in 2020. This is maybe a bug in Xamarin? You can easily reproduce this issue by using the MasterDetailPage template and then use the Android TV emulator in Visual Studio. I have not been able to find a workaround.... Has anyone been able to figure it out or figure out a good workaround?

    @MetodB @AdamP @TobyK

    Thursday, November 12, 2020 1:50 PM