Open Neotrickster opened 2 years ago
Can you please add some code or a reproduction project on how you set the selected item? Thanks
Hi @jfversluis
Can you please add some code or a reproduction project on how you set the selected item? Thanks
Was the default project (Flyout App Template) , no added code, just the default project.
In Android you don´t set anything and the first items is always selected by default, and iOS was working same way back in september.
I did a test using some code to select a default item, but same results ( no selected default item until change item and change it back).
In AppShell.xaml file add x:Name="AcercaDe":
In AppShell.xaml.cs file:
public AppShell() { InitializeComponent();
// Select a root Flyout item.
CurrentItem = AcercaDe;
Routing.RegisterRoute(nameof(ItemDetailPage), typeof(ItemDetailPage));
Routing.RegisterRoute(nameof(NewItemPage), typeof(NewItemPage));
}
Interestingly enough it doesn't happen in all scenarios. Seems to have something to do with updating the UI thread though.
If you do this
Device.BeginInvokeOnMainThread(() =>
{
// Select a root Flyout item.
CurrentItem = AcercaDe;
});
I does work
Interestingly enough it doesn't happen in all scenarios. Seems to have something to do with updating the UI thread though.
If you do this
Device.BeginInvokeOnMainThread(() => { // Select a root Flyout item. CurrentItem = AcercaDe; });
I does work
I tested with your code and it works on my app. Oddly enough, it works 2 releases ago (on september release) out of the box and have same behavior on iOS 12.5 and iOS 15.1. But looks like a workaround you put in there.
Thanks a lot.
In the meantime I gonna wrap your code inside a platforms specific if sentence.
if (Device.RuntimePlatform == Device.iOS)
Device.BeginInvokeOnMainThread(() =>
{
// Select a root Flyout item.
CurrentItem = AcercaDe;
});
Interesting enough, is failing again even with the Device.BeginInvokeOnMainThread code, but now the CurrentItem is correct but just doesn't show the color to highlight the selected item.
Using Xamarin Forms 5.0.0.2337, XCT 2.0.0 and Xamarin Essentials 1.7.1
Description
Using Visual Studio for Mac, the iOS Shell Flyout default item is not selected
Only after select another option and then return is selected.
Steps to Reproduce
Expected Behavior
First Flyout Item select (as in Android)
Actual Behavior
First Flyout Item not selected
Basic Information
Environment
=== Visual Studio Community 2019 for Mac ===
Version 8.10.13 (build 11) Installation UUID: 5847dc4a-f5b6-473a-b2a8-4f255c565278 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
=== Mono Framework MDK ===
Runtime: Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit) Package version: 612000140
=== Roslyn (Language Service) ===
3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb
=== NuGet ===
Version: 5.9.0.7134
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/5.0.402/Sdks SDK Versions: 5.0.402 5.0.401 5.0.400 5.0.302 5.0.301 5.0.203 5.0.201 5.0.103 5.0.102 5.0.101 5.0.100 3.1.414 3.1.413 3.1.412 3.1.411 3.1.410 3.1.409 3.1.407 3.1.406 3.1.405 3.1.404 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 5.0.11 5.0.10 5.0.9 5.0.8 5.0.7 5.0.6 5.0.4 5.0.3 5.0.2 5.0.1 5.0.0 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 3.1.13 3.1.12 3.1.11 3.1.10
=== .NET Core 3.1 SDK ===
SDK: 3.1.414
=== Xamarin.Profiler ===
Version: 1.6.15.68 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Apple Developer Tools ===
Xcode 13.1 (19466) Build 13A1030d
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 15.2.0.1 (Visual Studio Community) Hash: 8fd9e6289 Branch: xcode13.1 Build date: 2021-10-26 10:13:56-0400
=== Xamarin.Android ===
Version: 12.0.0.3 (Visual Studio Community) Commit: xamarin-android/d16-11/f0e3c2d Android SDK: /Users/piccolo/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 7.0 (API level 24) 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27)
SDK Tools Version: 26.1.1 SDK Platform Tools Version: 31.0.3 SDK Build Tools Version: 30.0.2
Build Information: Mono: c633fe9 Java.Interop: xamarin/java.interop/d16-11@476bb5b ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.35.4@85460d3 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@87af37b
=== Eclipse Temurin JDK ===
Java SDK: /Users/piccolo/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.10.0.13 Hash: 1b81df5 Branch: remotes/origin/d16-10 Build date: 2021-09-28 20:47:12 UTC
=== Android Device Manager ===
Version: 16.10.0.15 Hash: 89dcc0b Branch: remotes/origin/d16-10 Build date: 2021-09-28 20:47:30 UTC
=== Xamarin Designer ===
Version: 16.11.0.39 Hash: cd672761d Branch: remotes/origin/d16-11 Build date: 2021-10-06 20:09:18 UTC
=== Build Information ===
Release ID: 810130011 Git revision: 53e3946a0f6b630a1124eb7ff26c1b545d040d32 Build date: 2021-11-04 11:20:46-04 Build branch: release-8.10
=== Operating System ===
Mac OS X 10.16.0 Darwin 20.6.0 Darwin Kernel Version 20.6.0 Tue Oct 12 18:33:42 PDT 2021 root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64