Xamarin Forms duplicated Toolbar in Master Detail Page in iOS
I Have an app with master-detail page and toolbar items for every page. I set the master-detail page and the master page to NavigationPage.HasNavigationBar="False" to avoid duplication of the toolbar items. In Android, it works fine and no duplication, but for iOS, it still gives a duplicate for the toolbar items that has Order="Secondary"
Here is the Menu Page(Detail page):
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"
xmlns:effects="clr-namespace:AppXamarin"
x:Class="AppXamarin.Pages.MenuPage" NavigationPage.HasBackButton="False">
<ContentPage.BackgroundImage>
<OnPlatform Android="exp20181029Artboard46" iOS="OnIdiom Phone='exp20181029Artboard46',Tablet='Artboard'"/>
</ContentPage.BackgroundImage>
<ContentPage.ToolbarItems>
<ToolbarItem Name="menuitem1" Order="Secondary" Text="logout" Priority="0" Clicked="MenuItem1_Clicked"/>
<ToolbarItem Order="Primary" Priority="1" Clicked="cart_Clicked" Text="cart" x:Name="cart"/>
<ToolbarItem Order="Primary" Priority="0" Text="search" x:Name="searchbar" Icon="search.png"/>
</ContentPage.ToolbarItems>
Master Main Page:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AppXamarin.Pages"
x:Class="AppXamarin.Pages.MasterMainPage" NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False"
>
<MasterDetailPage.Master>
<local:MasterPage x:Name ="masterPage"/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:MenuPage></local:MenuPage>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
And the Master Page:
<?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="AppXamarin.Pages.MasterPage"
NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False" >
<ContentPage.Title>
<OnPlatform Android="Menu" iOS="☰"/>
</ContentPage.Title>
<ContentPage.Icon>
<OnPlatform Android="menu.png"/>
</ContentPage.Icon>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
iOS result here
Android result here
Thanks in advance.
add a comment |
I Have an app with master-detail page and toolbar items for every page. I set the master-detail page and the master page to NavigationPage.HasNavigationBar="False" to avoid duplication of the toolbar items. In Android, it works fine and no duplication, but for iOS, it still gives a duplicate for the toolbar items that has Order="Secondary"
Here is the Menu Page(Detail page):
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"
xmlns:effects="clr-namespace:AppXamarin"
x:Class="AppXamarin.Pages.MenuPage" NavigationPage.HasBackButton="False">
<ContentPage.BackgroundImage>
<OnPlatform Android="exp20181029Artboard46" iOS="OnIdiom Phone='exp20181029Artboard46',Tablet='Artboard'"/>
</ContentPage.BackgroundImage>
<ContentPage.ToolbarItems>
<ToolbarItem Name="menuitem1" Order="Secondary" Text="logout" Priority="0" Clicked="MenuItem1_Clicked"/>
<ToolbarItem Order="Primary" Priority="1" Clicked="cart_Clicked" Text="cart" x:Name="cart"/>
<ToolbarItem Order="Primary" Priority="0" Text="search" x:Name="searchbar" Icon="search.png"/>
</ContentPage.ToolbarItems>
Master Main Page:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AppXamarin.Pages"
x:Class="AppXamarin.Pages.MasterMainPage" NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False"
>
<MasterDetailPage.Master>
<local:MasterPage x:Name ="masterPage"/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:MenuPage></local:MenuPage>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
And the Master Page:
<?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="AppXamarin.Pages.MasterPage"
NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False" >
<ContentPage.Title>
<OnPlatform Android="Menu" iOS="☰"/>
</ContentPage.Title>
<ContentPage.Icon>
<OnPlatform Android="menu.png"/>
</ContentPage.Icon>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
iOS result here
Android result here
Thanks in advance.
add a comment |
I Have an app with master-detail page and toolbar items for every page. I set the master-detail page and the master page to NavigationPage.HasNavigationBar="False" to avoid duplication of the toolbar items. In Android, it works fine and no duplication, but for iOS, it still gives a duplicate for the toolbar items that has Order="Secondary"
Here is the Menu Page(Detail page):
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"
xmlns:effects="clr-namespace:AppXamarin"
x:Class="AppXamarin.Pages.MenuPage" NavigationPage.HasBackButton="False">
<ContentPage.BackgroundImage>
<OnPlatform Android="exp20181029Artboard46" iOS="OnIdiom Phone='exp20181029Artboard46',Tablet='Artboard'"/>
</ContentPage.BackgroundImage>
<ContentPage.ToolbarItems>
<ToolbarItem Name="menuitem1" Order="Secondary" Text="logout" Priority="0" Clicked="MenuItem1_Clicked"/>
<ToolbarItem Order="Primary" Priority="1" Clicked="cart_Clicked" Text="cart" x:Name="cart"/>
<ToolbarItem Order="Primary" Priority="0" Text="search" x:Name="searchbar" Icon="search.png"/>
</ContentPage.ToolbarItems>
Master Main Page:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AppXamarin.Pages"
x:Class="AppXamarin.Pages.MasterMainPage" NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False"
>
<MasterDetailPage.Master>
<local:MasterPage x:Name ="masterPage"/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:MenuPage></local:MenuPage>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
And the Master Page:
<?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="AppXamarin.Pages.MasterPage"
NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False" >
<ContentPage.Title>
<OnPlatform Android="Menu" iOS="☰"/>
</ContentPage.Title>
<ContentPage.Icon>
<OnPlatform Android="menu.png"/>
</ContentPage.Icon>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
iOS result here
Android result here
Thanks in advance.
I Have an app with master-detail page and toolbar items for every page. I set the master-detail page and the master page to NavigationPage.HasNavigationBar="False" to avoid duplication of the toolbar items. In Android, it works fine and no duplication, but for iOS, it still gives a duplicate for the toolbar items that has Order="Secondary"
Here is the Menu Page(Detail page):
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"
xmlns:effects="clr-namespace:AppXamarin"
x:Class="AppXamarin.Pages.MenuPage" NavigationPage.HasBackButton="False">
<ContentPage.BackgroundImage>
<OnPlatform Android="exp20181029Artboard46" iOS="OnIdiom Phone='exp20181029Artboard46',Tablet='Artboard'"/>
</ContentPage.BackgroundImage>
<ContentPage.ToolbarItems>
<ToolbarItem Name="menuitem1" Order="Secondary" Text="logout" Priority="0" Clicked="MenuItem1_Clicked"/>
<ToolbarItem Order="Primary" Priority="1" Clicked="cart_Clicked" Text="cart" x:Name="cart"/>
<ToolbarItem Order="Primary" Priority="0" Text="search" x:Name="searchbar" Icon="search.png"/>
</ContentPage.ToolbarItems>
Master Main Page:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AppXamarin.Pages"
x:Class="AppXamarin.Pages.MasterMainPage" NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False"
>
<MasterDetailPage.Master>
<local:MasterPage x:Name ="masterPage"/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:MenuPage></local:MenuPage>
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
And the Master Page:
<?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="AppXamarin.Pages.MasterPage"
NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False" >
<ContentPage.Title>
<OnPlatform Android="Menu" iOS="☰"/>
</ContentPage.Title>
<ContentPage.Icon>
<OnPlatform Android="menu.png"/>
</ContentPage.Icon>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
iOS result here
Android result here
Thanks in advance.
asked Nov 13 '18 at 9:17
mohammad anoutimohammad anouti
417
417
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
switch (Device.RuntimePlatform)
case Device.iOS:
NavigationPage.SetHasNavigationBar(this, false);
break;
Try this in the Code-Behind
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
add a comment |
Maybe there is a bug on iOS for secondary toolbar items. I handle it by setting the order to primary on iOS and secondary on Android.
<ToolbarItem Name="menuitem1" Text="logout" Priority="0" Clicked="MenuItem1_Clicked">
<ToolbarItem.Order>
<OnPlatform Android="Secondary" iOS="Primary"/>
</ToolbarItem.Order>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277553%2fxamarin-forms-duplicated-toolbar-in-master-detail-page-in-ios%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
switch (Device.RuntimePlatform)
case Device.iOS:
NavigationPage.SetHasNavigationBar(this, false);
break;
Try this in the Code-Behind
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
add a comment |
switch (Device.RuntimePlatform)
case Device.iOS:
NavigationPage.SetHasNavigationBar(this, false);
break;
Try this in the Code-Behind
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
add a comment |
switch (Device.RuntimePlatform)
case Device.iOS:
NavigationPage.SetHasNavigationBar(this, false);
break;
Try this in the Code-Behind
switch (Device.RuntimePlatform)
case Device.iOS:
NavigationPage.SetHasNavigationBar(this, false);
break;
Try this in the Code-Behind
answered Nov 13 '18 at 9:23
Janwilx72Janwilx72
308214
308214
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
add a comment |
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
Still the same, you can see I already set it to false in both Master Page and Master Main Page in the Xaml. It seems there is a bug with the Secondary order in Master-Detail Page, I fix it by setting it primary on iOS and secondary on Android
– mohammad anouti
Nov 13 '18 at 9:39
add a comment |
Maybe there is a bug on iOS for secondary toolbar items. I handle it by setting the order to primary on iOS and secondary on Android.
<ToolbarItem Name="menuitem1" Text="logout" Priority="0" Clicked="MenuItem1_Clicked">
<ToolbarItem.Order>
<OnPlatform Android="Secondary" iOS="Primary"/>
</ToolbarItem.Order>
add a comment |
Maybe there is a bug on iOS for secondary toolbar items. I handle it by setting the order to primary on iOS and secondary on Android.
<ToolbarItem Name="menuitem1" Text="logout" Priority="0" Clicked="MenuItem1_Clicked">
<ToolbarItem.Order>
<OnPlatform Android="Secondary" iOS="Primary"/>
</ToolbarItem.Order>
add a comment |
Maybe there is a bug on iOS for secondary toolbar items. I handle it by setting the order to primary on iOS and secondary on Android.
<ToolbarItem Name="menuitem1" Text="logout" Priority="0" Clicked="MenuItem1_Clicked">
<ToolbarItem.Order>
<OnPlatform Android="Secondary" iOS="Primary"/>
</ToolbarItem.Order>
Maybe there is a bug on iOS for secondary toolbar items. I handle it by setting the order to primary on iOS and secondary on Android.
<ToolbarItem Name="menuitem1" Text="logout" Priority="0" Clicked="MenuItem1_Clicked">
<ToolbarItem.Order>
<OnPlatform Android="Secondary" iOS="Primary"/>
</ToolbarItem.Order>
answered Nov 13 '18 at 9:43
mohammad anoutimohammad anouti
417
417
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277553%2fxamarin-forms-duplicated-toolbar-in-master-detail-page-in-ios%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown