I have a MAUI app, with the code below. For tablet and desktop. On Windows, it works as expected, when you click an item in the flyout menu the detail content gets populated. However, on Android, nothing happens. I can step through the code and see that it is getting executed. But nothing is displayed. I've trawled the documentation and there isn't anything I can find to explain this behaviour. Can anyone help?
I'm converting an app from Xamarin and its like pulling teeth :(
Here are some video clips of the problem. In Xamarin it was a MasterDetailPage so slightly different tech.
Main Page
<ScrollView>
<CollectionView x:Name="collectionView"
x:FieldModifier="public"
SelectionMode="Single"
SelectionChanged="collectionView_SelectionChanged"
Background="White">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="5,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="{Binding IconSource}" BackgroundColor="Transparent" />
<StackLayout Orientation="Horizontal" Grid.Column="1" BackgroundColor="Transparent">
<Label Grid.Column="0" Grid.Row="0"
Margin="10,0"
Text="{Binding Title}"
FontSize="20"
FontAttributes="Bold"
VerticalOptions="Center"/>
<Image Grid.Column="0" Grid.Row="0" Source="checkw.png" HorizontalOptions="End" VerticalOptions="Start" HeightRequest="16"></Image>
</StackLayout>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
Code Behind
private void collectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var item = e.CurrentSelection.FirstOrDefault() as FlyoutPageItem;
if (item != null)
{
FlyoutPage page = (FlyoutPage)this.Parent;
page.Detail = new NavigationPage(new Pages.Claim.Actions());// new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
page.Title = item.Title;
//page.IsPresented = false;
}
}
protected override void OnNavigatedTo(NavigatedToEventArgs args)
{
base.OnNavigatedTo(args);
List<FlyoutPageItem> pages = new()
{
new FlyoutPageItem {Title = "Actions", TargetType = typeof(Pages.Claim.Actions), IconSource = "actionact.png" },
new FlyoutPageItem {Title = "Agreement", TargetType = typeof(Pages.Claim.Agreement), IconSource = "actionagr.png" },
new FlyoutPageItem {Title = "Asbestos", TargetType = typeof(Pages.Claim.Asbestos), IconSource = "actionasb.png" },
new FlyoutPageItem {Title = "Buildings", TargetType = typeof(Pages.Claim.Buildings), IconSource = "actionbld.png" },
};
collectionView.ItemsSource = pages;
}