Xamarin 如何创建简单的汉堡包菜单或菜单导航
我有以下命令,但我不能调用菜单导航或简单汉堡菜单,我已经准备好xaml我有我的app.cs,如何调用我主页中的菜单 注:我的项目是跨平台的(IOS、Android、WP)Xamarin 如何创建简单的汉堡包菜单或菜单导航,xamarin,Xamarin,我有以下命令,但我不能调用菜单导航或简单汉堡菜单,我已经准备好xaml我有我的app.cs,如何调用我主页中的菜单 注:我的项目是跨平台的(IOS、Android、WP) 菜单页 <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/x
菜单页
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Hanselman.Portable.Views.MenuPage"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
Title="{Binding Title}"
Icon="{Binding Icon}">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand">
<ListView
CachingStrategy="RecycleElement"
HasUnevenRows="True"
x:Name="ListViewMenu">
<ListView.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="80"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
</Grid.RowDefinitions>
<BoxView Grid.ColumnSpan="3"
Grid.RowSpan="4"
BackgroundColor="#234084"/>
<Label
Grid.Column="1"
Grid.Row="2"
Text="Titulo"
TextColor="White"
FontSize="30"
Style="{DynamicResource SubtitleStyle}"/>
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--<Image Source="{Binding Icon}" HeightRequest="25" WidthRequest="25"/>-->
<Label Grid.Column="1" Text="{Binding Title}" FontSize="18"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
使用母版详细信息页面:随之而来的另一个问题是,如何将选项卡式页面放在我的母版页面中?您通常会将详细信息页面(而不是母版)设置为选项卡式页面。你对此有什么问题?抱歉,我给了它一个主页,但实际上是MasterDetailPage,我不能在MasterDetailPage中放置选项卡页。如果你说“不能”,我会详细说明你具体尝试了什么,或者你遇到了什么样的错误。请参阅错误:System.InvalidOperationException:在将MasterDetailPage添加到容器之前,必须设置Master和Detail
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Hanselman.Portable.Views.MenuPage"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
Title="{Binding Title}"
Icon="{Binding Icon}">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand">
<ListView
CachingStrategy="RecycleElement"
HasUnevenRows="True"
x:Name="ListViewMenu">
<ListView.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="80"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
</Grid.RowDefinitions>
<BoxView Grid.ColumnSpan="3"
Grid.RowSpan="4"
BackgroundColor="#234084"/>
<Label
Grid.Column="1"
Grid.Row="2"
Text="Titulo"
TextColor="White"
FontSize="30"
Style="{DynamicResource SubtitleStyle}"/>
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--<Image Source="{Binding Icon}" HeightRequest="25" WidthRequest="25"/>-->
<Label Grid.Column="1" Text="{Binding Title}" FontSize="18"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
var tabs = new TabbedPage();
tabs.Children.Add(new ContentPage { Title = "TabA" });
tabs.Children.Add(new ContentPage { Title = "TabB" });
tabs.Children.Add(new ContentPage { Title = "TabC" });
this.Master = new ContentPage { Title = "Master" };
this.Detail = tabs;