我使用的是MasterDetailPage在exrin 这是我ViewContainer 公共类MainViewContainer:Exrin.Framework.ViewContainer,IMasterDetailContainer { 私人只读MasterDetailPage r_MasterPage;Exrin MasterDetailPage
public MainViewContainer(MenuStack i_MenuStack, MainStack i_MainStack)
: base(eContainer.Main.ToString())
{
r_MasterPage = new MasterDetailPage();
MasterDetailProxy masterProxy = new MasterDetailProxy(r_MasterPage);
NativeView = masterProxy.View;
Proxy = masterProxy;
DetailStack = i_MainStack;
MasterStack = i_MenuStack;
RegionMapping.Add(eRegions.Menu, ContainerType.Master);
RegionMapping.Add(eRegions.Main, ContainerType.Detail);
}
public IHolder MasterStack { get; set; }
public IHolder DetailStack { get; set; }
public IMasterDetailProxy Proxy { get; set; }
public bool IsPresented
{
get
{
return r_MasterPage.IsPresented;
}
set
{
r_MasterPage.IsPresented = value;
}
}
public void SetStack(ContainerType i_ContainerType, object i_Page)
{
switch (i_ContainerType)
{
case ContainerType.Detail:
r_MasterPage.Detail = i_Page as Page;
break;
case ContainerType.Master:
r_MasterPage.Master = i_Page as Page;
break;
}
}
}
,这是我IMasterDetailProxy 公共类MasterDetailProxy:IMasterDetailProxy { 私人只读MasterDetailPage r_MasterPage;
public MasterDetailProxy(MasterDetailPage i_MasterPage)
{
View = i_MasterPage;
r_MasterPage = i_MasterPage;
}
public object DetailNativeView
{
get
{
return r_MasterPage.Detail;
}
set
{
r_MasterPage.Detail = value as Page;
}
}
public object MasterNativeView
{
get
{
return r_MasterPage.Master;
}
set
{
Page page = value as Page;
if(string.IsNullOrEmpty(page.Title))
{
page.Title = "Please set your MasterPage Title";
}
r_MasterPage.Master = page;
}
}
public object View { get; set; }
}
我正在使用它显示主菜单和详细信息部分页面上的菜单。 我的功能表视图是
<base:PageProxy xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:base="clr-namespace:Exrin.Base;assembly=Exrin.Base"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
xmlns:control="clr-namespace:BeAttend.Control;assembly=BeAttend"
x:Class="BeAttend.View.MenuView" Title="Menu">
<base:PageProxy.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS" >Icon-Small.png</On>
</OnPlatform>
</base:PageProxy.Icon>
<ContentPage.Content>
<Grid BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid>
<Image Source="menubg.jpg" Aspect="AspectFill" />
<StackLayout Padding="0,20,0,0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" >
<controls:CircleImage BorderColor="White" BorderThickness="2" Source="{Binding VisualState.User.Picture}" Aspect="AspectFit" WidthRequest="100" HeightRequest="100" />
<Label Text="{Binding VisualState.User.Name}" TextColor="White" FontSize="Large" />
</StackLayout>
</Grid>
<StackLayout Margin="20,20,20,0" Grid.Row="1" Spacing="15">
<control:NavigationItem Text="Dashboard" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="Dashboard" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="Beacons" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="Beacons" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="Create event" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="CreateEvent" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="My events" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="MyEvents" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="Registered events" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="RegisteredEvents" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="Attendance QR" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="AttendanceQr" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="Join Event" Icon="fa-archive" Command="{Binding NavigationCommand}" CommandParameter="JoinEvent" />
<ContentView HeightRequest="1" BackgroundColor="Gray" />
<control:NavigationItem Text="Logout" Icon="fa-arrow-circle-left" Command="{Binding LogoutCommand}" />
</StackLayout>
</Grid>
</ContentPage.Content>
</base:PageProxy>
我有几个问题:1。 在Android上我自动拥有汉堡包菜单按钮,但在iOS上我没有任何的图标,我试着设置了一个图标iOS的菜单视图使用
<base:PageProxy.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS" >Icon-Small.png</On>
</OnPlatform>
</base:PageProxy.Icon>
在菜单视图,但它不起作用。 2.在iOS上的网页标题是“请设置您的母版标题”(代理设置,如果网页标题是空的),但你可以在我设定的页面标题菜单视图中看到,这只是发生在iOS 。 https://drive.google.com/file/d/0B3YFjr58f7_OMC04Y0FreVRvVlE/view?usp=sharing
按压我想主页消失它目前停留在与直到我按下详细信息页面上隐藏的详细页面的一部分的菜单上的一个链接时。
在详细信息页面上,我有一个后退按钮,所以如果要导航到另一个页面,我必须先按回,然后我可以看到菜单图标以显示母版页并选择另一个链接。如何更换后退按钮以始终显示汉堡包菜单按钮? 这是我的筹码
公共类MainStack:BaseStack { 公共MainStack(IViewService i_ViewService) :基地(新NavigationProxy(新NavigationPage()),i_ViewService,eStack.Main,nameof(Views.eMain.Dashboard) ) { ShowNavigationBar = TRUE; }
protected override void Map() { NavigationMap<DashboardView, DashboardViewModel>(nameof(Views.eMain.Dashboard)); NavigationMap<BeaconsView, BeaconsViewModel>(nameof(Views.eMain.Beacons)); NavigationMap<BeaconAddView, BeaconAddViewModel>(nameof(Views.eMain.AddBeacon)); NavigationMap<BeaconEditView, BeaconEditViewModel>(nameof(Views.eMain.EditBeacon)); NavigationMap<EventCreateView, EventCreateViewModel>(nameof(Views.eMain.CreateEvent)); NavigationMap<EventsCreatedView, EventsCreatedViewModel>(nameof(Views.eMain.MyEvents)); NavigationMap<EventsRegisteredView, EventsRegisteredViewModel>(nameof(Views.eMain.RegisteredEvents)); NavigationMap<EventEditView, EventEditViewModel>(nameof(Views.eMain.EditEvent)); NavigationMap<EventView, EventViewModel>(nameof(Views.eMain.ViewEvent)); NavigationMap<AttendanceQrView, AttendanceQrViewModel>(nameof(Views.eMain.AttendanceQr)); NavigationMap<JoinEventView, JoinEventViewModel>(nameof(Views.eMain.JoinEvent)); } }
我会尽量回答什么问题,我可以。请打破他人,所以每个帖子有1个问题。 –