Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

xamarin.forms - Can xamarin forms shell use MasterDetailPage?

I created cross platform project for android having dependencies xamarin.essentials1.5.3.2 and xamarin.forms4.8.0.1451 (the defaults) with tabbed layout. Then I added TestMasterDetailPage using MasterDetailPage template. AppShell.xaml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms" 
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:local="clr-namespace:MasterDetailTest.Views"
       Title="MasterDetailTest"
       x:Class="MasterDetailTest.AppShell">
    <TabBar>
        <ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />
        <ShellContent Title="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" />
        <ShellContent Title="TestMasterDetailPage" Route="TestMasterDetailPage" ContentTemplate="{DataTemplate local:TestMasterDetailPage}" />
    </TabBar>
</Shell>

I removed some unused code and added 3rd tab in TabBar. When launching it and pressing on new tab I get error in external code: System.InvalidCastException: 'Specified cast is not valid.'

I found this question which looks identical, however it's 2yo and I'm not sure if shell was used for template at that time. Also, like mentioned before, crash happens somewhere in external code.

question from:https://stackoverflow.com/questions/65602394/can-xamarin-forms-shell-use-masterdetailpage

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...