Duplicate Xamarin Navbar Toolbar Items - xamarin

I'm making an app in Xamarin Forms and when I deploy it to Android, I get a weird problem. It appears that I have two toolbar items when I only declared one in XAML. Also, I believe this is proper behaviour, but I was wondering if it's possible to not display the navbar title on a lower line and rather display it upper center. Thanks!
Screenshot
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Biziboards.Views.MerchantListPage"
Title="Merchants">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Home"
x:Name="btnHome"
Clicked="btnHome_Clicked"
Order="Primary"/>
</ContentPage.ToolbarItems>

In your pages Xaml.cs file:
NavigationPage.SetHasNavigationBar(this, false);

Related

Xamarin forms Prism Content Page Design

I'm working on Xamarin Project and I don't need navigation bur, I switched it off but now I cant move app content of 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:prism="http://prismlibrary.com"
prism:ViewModelLocator.AutowireViewModel="True"
xmlns:imgExt="clr-namespace:GulfStar.Xamarin.Extensions"
x:Class="GulfStar.Xamarin.Views.StatusPickerPage"
NavigationPage.HasNavigationBar="False">
<StackLayout>
<StackLayout Orientation="Horizontal" VerticalOptions="Start" >
<Image Source="{imgExt:ImageResource GulfStar.Xamarin.Images.Icon.png}" WidthRequest="70" HeightRequest="70"/>
<Label HorizontalOptions="Center" Margin="0,17,0,0" FontSize="Title">GSI Accountability</Label>
</StackLayout>
</StackLayout>
</ContentPage>
I figured out who it happen
How to remove blue section
Use NavigationPage.SetHasNavigationBar(this, false); to hide the navigation bar.
I figured out how to make that thing disappears
when you navigation to some page does not use Navigation page NavigationService.NavigateAsync("NavigationPage/StatusPickerPage");
Use
NavigationService.NavigateAsync("StatusPickerPage");
And it would not track navigation and its not needed if you have only two pages

How can I change the font size in the title area of the Navigation bar in Xamarin Forms?

The font that I have is too big for the amount of words that I would like to display. Does anyone have any suggestions as to how I can change the font size. I would prefer to be able to do it in the shared code but if it needs a custom renderer then can someone show me how this can be done?
So, if you are using Xamarin.Forms 3.2.0 or above, you can use TitleView property like this:
<?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="Xamarin.Forms.Controls.GalleryPages.TitleView">
<NavigationPage.TitleView>
<Label Text="This is my Title" FontSize="12" TextColor="White" />
</NavigationPage.TitleView>
<!-- YOUR CONTENT HERE-->
</ContentPage>

How to add Search bar in top of a tabbed page in xamarin forms

In my xamarin app,I want to add a search bar on top of the page in my tabbed page.
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Sample.Mobile.Test">
<StackLayout>
<SearchBar></SearchBar>
</StackLayout>
<TabbedPage.Children>
<ContentPage x:Name="tab1" Title="Home">
</ContentPage>
</TabbedPage.Children>
</TabbedPage>
You can use follow this link for the Search bar Implementation
https://developer.xamarin.com/api/type/Xamarin.Forms.SearchBar/

Xamarin CarouselPage not showing if not master page

I've inherited a Xamarin project and am not sure why I'm seeing this behavior when trying to work with a CarouselPage.
Using the Prism NavigationService, if I navigate to the carousel page as the "base page", it shows fine, but if I navigate to it as a "sub page" (to push it on the navigation stack?) it doesn't show, though I get no errors.
The problem is that using the navigation method that works doesn't provide me with a back button.
Example:
// this works, but no back button
await _navigationService.NavigateAsync("file:///MenuMasterDetailPage/MenuNavigationPage/MyCarouselPage");
// this doesn't, have back button but no content is shown
await _navigationService.NavigateAsync("MyCarouselPage");
I'm unsure how the master/detail/navigation stuff really works: not sure if my issue is there or if there's something special about a CarouselPage that prevents it from being rendered in the second case.
The MyCarouselPage is as simple as can be while I try to get this to work:
<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
x:Class="Views.ImageCarouselPage"
effects:BackgroundImageEffect.BackgroundImage="Resources.SignInBackground.png">
<ContentPage>
<StackLayout VerticalOptions="FillAndExpand">
<Image Source="https://s3.amazonaws.com/blah.jpg" Aspect="AspectFit" VerticalOptions="FillAndExpand" />
</StackLayout>
</ContentPage>
<ContentPage>
<StackLayout VerticalOptions="FillAndExpand">
<Image Source="https://s3.amazonaws.com/blah.jpg" Aspect="AspectFit" VerticalOptions="FillAndExpand" />
</StackLayout>
</ContentPage>
</CarouselPage>
(I should note that the background image does display, but the contents of the carousel does not).
Any ideas? Thanks.

XLabs CalendarView month selection

Is anyone having trouble with the CalendarView component from XLabs? I have written the XAML code below, tried to run it on my Android device, and it displays just fine, only there's no way to change the current month (I'm expecting a swipe should work), nor can I see any navigation arrows.
Anyone got any idea what's going on?
<?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:XLabs.Forms.Controls;assembly=XLabs.Forms"
xmlns:local="clr-namespace:TestXAML"
x:Class="TestXAML.MainPage"
Padding="10">
<controls:CalendarView
x:Name="calendarioConsultas"
HorizontalOptions="Fill"
ShowNavigationArrows="True"
BackgroundColor="Transparent"
NavigationArrowsColor="Black"
/>
</ContentPage>
Ok, I solved it by setting MinDate parameter to 01/01/1970. Turns out that navigation doesn't work unless you specify MinDate or MaxDate.

Resources