Can I set customised title bar for a master detail Page - xamarin.forms

I want to have an
-Image button
-logo
-text view
How to set the title bar with these constraints?

You can Add them by Toolbar Items in XAML
<ContentPage.ToolbarItems>
<ToolbarItem Icon="logo.png" Text="Sample" />
</ContentPage.ToolbarItems>

You cannot unless you create your own custom toolbar from scratch using custom renderers.

Related

Create custom toolbar for ios in xamarin visual studio 17

I want to create a custom toolbar with app name and his icon this toolbar should be included in all Page of the applications. This toolbar should be for ios because in all others examples which i haave seen they are using Main.storyboard which iss not in visual studio 17. Thanks
I want to create a custom toolbar with app name and his icon this toolbar
You can refer to this official document to know more about ToolBarItem in Xamarin Forms.
Code as follow in Xaml:
<ContentPage.ToolbarItems>
<ToolbarItem Name="MenuItem1" Icon="icon.png" Priority="0" Order="Primary" />
</ContentPage.ToolbarItems>
Or in ContentPage :
new ToolbarItem () { Icon = "icon.png" }
And this app name can be setted in ContentPage with Title property as follow:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App3"
xmlns:autocomplete="clr-namespace:Syncfusion.SfAutoComplete.XForms;assembly=Syncfusion.SfAutoComplete.XForms"
x:Class="App3.MainPage"
Title="AppNameTitle">
Here is a good article for reference.

Change 3 dots of secondary toolbar to an icon in xamarin forms

I want to replace the default '3 dots'(that displays the secondary items) to text or icon on the title bar of a page in xamarin forms.
Is this possible and how can I achieve this?
Thank you for the responses in advance.
Making sure to add the method that will handle the Activated event in C#.
In XAML, before the opening tag of your ContentPage.Content, add the code below.
From dots to Text
<ContentPage.ToolbarItems>
<ToolbarItem Text="Hi" Clicked="Clicked_1"/>
<ToolbarItem Text="Hello" Clicked="Clicked_2"/>
</ContentPage.ToolbarItems>
From dots to Icon
<ContentPage.ToolbarItems>
<ToolbarItem Icon="icon.png" Activated="Clicked_3" Text="Icon" Order="Primary"/>
</ContentPage.ToolbarItems>

SlideOverKit Menu as hamburger menu using FreshMVVM

I am new in Xamarin and learning FreshMVVM.
Please can anyone guide me how can I dispaly SlideOverKit: Right Menu as hamburger menu instead on button click using FreshMVVM for MasterDetail form.
Thanks in advance.
I am not sure abut FreshMVVM but all you have to do is to add a ToolbarItem which has an icon of Menu. Than, bind the click command to show the slideOverKit menu.
<ContentPage>
<ContentPage.ToolbarItems>
<ToolbarItem Name="Cart" Command="{Binding GoToCartCommand}" Icon="Icons/cart.png"></ToolbarItem>
</ContentPage.ToolbarItems>
<ContentPage.Content>
<!-- your content goes here -->
</ContentPage.Content>
</ContentPage>

What is the best way to create the MasterDetailPage menu items in Xamarin.Forms

I'm using a MasterDetailPage in my Xamarin.Forms application.
To creat the menu items, I use buttons
<MasterDetailPage.Master>
<ContentPage Title="Menu">
<StackLayout Orientation="Vertical">
<Button Text="Club-House" Command="{Binding ClubHouseCommand}" />
<Button Text="Parcours" />
<BoxView VerticalOptions="CenterAndExpand" />
<Button Text="A propos" Command="{Binding AProposCommand}" VerticalOptions="End" />
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
Is there a better way to do it ? I was thinking about something more menuish like MenuItem or else.
Thanks
There is nothing standard for implementing a menu in the Master page.
You can use
ListView
StackLayout
Grid
Or a combination. StackLayout and ListView will most likely be your best options. Personally I go for a StackLayout because it's quicker to code and render than a ListView, which may come with more issues than advantages. However if I have a large menu (which I try to avoid), ListView may be quicker to code. But ListViews are generally meant for dynamically loaded data, not static.
As for the elements, the most common will be
Button
Label
While buttons are designed for clicking, sometimes I move to label's if I don't want to have to undo all the default styling, and use the TapGestureRecognizer.
You can create a new User Control for a menu item, to avoid code replication.
All up, there is no standard. Make it easy to code and understand, and quick to render. How you do that, depends on your requirements.

How to add top right save button nav bar in content page xamarin forms

I have a form page with many fields after editing user have to scroll down all the way down to click save button. Which seems like not user friendly experience i want to move that button at top right position in content page. SO far i found a thing name ToolBarItems in which i can add button but this not helped.
Have you tried adding a ToolbarItem to your page. You can do this in Xaml like so:
<ContentPage.ToolbarItems>
<ToolbarItem Name="Menu1" Activated="OnClick" Order="Primary" Priority="0" />
<ToolbarItem Name="Menu2" Activated="OnClick" Order="Primary" Priority="1" />
</ContentPage.ToolbarItems>
Or if you prefer code behind that can also be done like so:
page.ToolbarItems.Add (new ToolbarItem (....));
Ref: http://codeworks.it/blog/?p=232

Resources